init: 山西治金技师学院MES管理系统首次入库

This commit is contained in:
XingCheng3
2026-06-08 17:03:11 +08:00
commit 084a2b9d95
82 changed files with 92088 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
.vs/
*.user
*.suo
*.cache
*.log
_system~.ini

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
您 Web 项目的发布/打包进程将使用此文件。您可以通过编辑此 MSBuild 文件
来自定义该进程的行为。若要了解与此相关的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=208121。
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>True</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
<ExcludeApp_Data>True</ExcludeApp_Data>
<publishUrl>C:\test</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>

BIN
Bin/Aspose.Cells.dll Normal file

Binary file not shown.

BIN
Bin/BasicData.dll Normal file

Binary file not shown.

BIN
Bin/BasicData.pdb Normal file

Binary file not shown.

BIN
Bin/DataLinkMesWork.dll Normal file

Binary file not shown.

BIN
Bin/DataLinkMesWork.pdb Normal file

Binary file not shown.

4511
Bin/DataLinkMesWork.xml Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
Bin/NPOI.OOXML.dll Normal file

Binary file not shown.

BIN
Bin/NPOI.OOXML.pdb Normal file

Binary file not shown.

9621
Bin/NPOI.OOXML.xml Normal file

File diff suppressed because it is too large Load Diff

BIN
Bin/NPOI.OpenXml4Net.dll Normal file

Binary file not shown.

BIN
Bin/NPOI.OpenXml4Net.pdb Normal file

Binary file not shown.

3019
Bin/NPOI.OpenXml4Net.xml Normal file

File diff suppressed because it is too large Load Diff

BIN
Bin/NPOI.OpenXmlFormats.dll Normal file

Binary file not shown.

BIN
Bin/NPOI.OpenXmlFormats.pdb Normal file

Binary file not shown.

BIN
Bin/NPOI.dll Normal file

Binary file not shown.

BIN
Bin/NPOI.pdb Normal file

Binary file not shown.

43613
Bin/NPOI.xml Normal file

File diff suppressed because it is too large Load Diff

BIN
Bin/Newtonsoft.Json.dll Normal file

Binary file not shown.

Binary file not shown.

BIN
Bin/Spire.License.dll Normal file

Binary file not shown.

BIN
Bin/Spire.Pdf.dll Normal file

Binary file not shown.

BIN
Bin/Spire.XLS.dll Normal file

Binary file not shown.

BIN
Bin/WriteExcelNPOI.dll Normal file

Binary file not shown.

BIN
Bin/WriteExcelNPOI.pdb Normal file

Binary file not shown.

1265
Bin/WriteExcelNPOI.xml Normal file

File diff suppressed because it is too large Load Diff

4
JS/jquery-3.2.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

63
MES_Manage.sln Normal file
View File

@@ -0,0 +1,63 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30002.166
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "MES_Manage", ".", "{4F66CC1F-BFDE-4EEA-B800-7CF049E5176A}"
ProjectSection(WebsiteProperties) = preProject
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
ProjectReferences = "{97127b87-d43d-457c-9894-5f2244e4d2e7}|DataLinkMesWork.dll;{d7e149c7-a7e2-41c7-a3d3-af5d2efc9af8}|WriteExcelNPOI.dll;"
Debug.AspNetCompiler.VirtualPath = "/localhost_57966"
Debug.AspNetCompiler.PhysicalPath = "..\MES_Manage\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_57966\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_57966"
Release.AspNetCompiler.PhysicalPath = "..\MES_Manage\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_57966\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "57966"
SlnRelativePath = "..\MES_Manage\"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "03.WriteExcelNPOI", "..\03.WriteExcelNPOI\03.WriteExcelNPOI.csproj", "{D7E149C7-A7E2-41C7-A3D3-AF5D2EFC9AF8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "02DataLinkMesWork", "..\02DataLinkMesWork\02DataLinkMesWork.csproj", "{97127B87-D43D-457C-9894-5F2244E4D2E7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "07_WinformApiApp", "..\WinformApiApp\07_WinformApiApp.csproj", "{802E9943-6998-4BBF-B901-FF79FFB53584}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4F66CC1F-BFDE-4EEA-B800-7CF049E5176A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F66CC1F-BFDE-4EEA-B800-7CF049E5176A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F66CC1F-BFDE-4EEA-B800-7CF049E5176A}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{4F66CC1F-BFDE-4EEA-B800-7CF049E5176A}.Release|Any CPU.Build.0 = Debug|Any CPU
{D7E149C7-A7E2-41C7-A3D3-AF5D2EFC9AF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7E149C7-A7E2-41C7-A3D3-AF5D2EFC9AF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7E149C7-A7E2-41C7-A3D3-AF5D2EFC9AF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7E149C7-A7E2-41C7-A3D3-AF5D2EFC9AF8}.Release|Any CPU.Build.0 = Release|Any CPU
{97127B87-D43D-457C-9894-5F2244E4D2E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97127B87-D43D-457C-9894-5F2244E4D2E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97127B87-D43D-457C-9894-5F2244E4D2E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97127B87-D43D-457C-9894-5F2244E4D2E7}.Release|Any CPU.Build.0 = Release|Any CPU
{802E9943-6998-4BBF-B901-FF79FFB53584}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{802E9943-6998-4BBF-B901-FF79FFB53584}.Debug|Any CPU.Build.0 = Debug|Any CPU
{802E9943-6998-4BBF-B901-FF79FFB53584}.Release|Any CPU.ActiveCfg = Release|Any CPU
{802E9943-6998-4BBF-B901-FF79FFB53584}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1F054BAF-3BFA-42C6-BF56-4717FA1418A2}
EndGlobalSection
EndGlobal

174
Web.config Normal file
View File

@@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<!--<add key="ERP_ConnectionString" value="server=192.168.137.1;database=MacroinfBasicDB_JF;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000"/>-->
<!--<add key="ConnectionString" value="server=.;database=MW-MES20180331;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />-->
<!--<add key="ConnectionString" value="server=.;database=ERPTOOL_HPP;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />-->
<!--<add key="ConnectionString" value="server=.,1333;database=MESBasicDB_HL;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />-->
<add key="ConnectionString" value="server=.,1333;database=DDVZJ;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<!--<add key="ConnectionString" value="server=.\MSSQLSERVER2012;database=MES_ManagerTest;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />-->
<!--<add key="ConnectionString" value="server=120.26.210.14\SQL2012,1433;database=SL;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />-->
<add key="ConnectionString01" value="server=119.45.113.185\DB01;database=EMS;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionString02" value="server=119.45.113.185\DB02;database=DB02;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionString03" value="server=119.45.113.185\DB03;database=DB03;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionString04" value="server=119.45.113.185\DB04;database=DB04;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionString05" value="server=119.45.113.185\DB05;database=DB05;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionString06" value="server=119.45.113.185\DB06;database=DB06;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionString07" value="server=119.45.113.185\DB07;database=DB07;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionString08" value="server=119.45.113.185\DB08;database=DB08;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionString09" value="server=119.45.113.185\DB09;database=DB09;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionString10" value="server=119.45.113.185\DB10;database=DB10;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<!--<add key="ConnectionString" value="server=123.56.95.229;database=ERPTOOL_GJ;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />-->
<!--<add key="ConnectionString" value="server=192.168.1.171;database=海洋;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />-->
<!--<add key="ConnectionString" value="server=.;database=ERPTOOL_GJ;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />-->
<add key="SN" value="WEBa1a524c0" />
<add key="MESWORKSN" value="C:\meswork.sn" />
<add key="connectionStringL2" value="max pool size=512;server=192.168.1.212;database=AMSReport_L2;uid=sa;pwd=ea211"/>
<add key="TempPath" value="Temp"/>
<add key="TimeOut" value="600"/>
<!--生产线名:一线 or 二线 -->
<!--<add key="LineName" value="一线"/>-->
<add key="LineName" value="二线"/>
<add key="OpNumber1" value="39,40,41,54,55,135,225,258,382,60,84"/>
<add key="DataLen1" value="46"/>
<!--<add key="OpNumber1" value="39,40,41,54,55,135,225,382,60,84"/>
<add key="DataLen1" value="43"/>-->
<!--不含op258-->
<add key="OpNumber2" value="72,73,74,96,97,147,273,480,664,432"/>
<add key="DataLen2" value="45"/>
<add key="IsBakup" value="0" />
<add key="IsBakup01" value="0" />
<add key="IsBakup02" value="0" />
<add key="IsBakup03" value="0" />
<add key="IsBakup04" value="0" />
<add key="IsBakup05" value="0" />
<add key="IsBakup06" value="0" />
<add key="IsBakup07" value="0" />
<add key="IsBakup08" value="0" />
<add key="IsBakup09" value="0" />
<add key="IsBakup10" value="0" />
<add key="ConnectionStringBakup" value="server=.\BAK00;database=BAK00;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionStringBakup01" value="server=.\BAK01;database=BAK01;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionStringBakup02" value="server=.\BAK02;database=BAK02;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionStringBakup03" value="server=.\BAK03;database=BAK03;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionStringBakup04" value="server=.\BAK04;database=BAK04;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionStringBakup05" value="server=.\BAK05;database=BAK05;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionStringBakup06" value="server=.\BAK06;database=BAK06;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionStringBakup07" value="server=.\BAK07;database=BAK07;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionStringBakup08" value="server=.\BAK08;database=BAK08;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionStringBakup09" value="server=.\BAK09;database=BAK09;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="ConnectionStringBakup10" value="server=.\BAK10;database=BAK10;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000" />
<add key="GPRSDataHost" value="61.51.183.90" />
<add key="GPRSDataPort" value="41101" />
<add key="TracingTraceFile" value="~/TracingTraceFile.txt" />
<add key="reportTempDir" value="C:\报表程序\excel模版" />
<add key="reportDir" value="C:\报表程序\excel输出" />
<add key="reportTempFileName" value="导入数据标准模块.xls" />
<add key="CollectorreportTempFileName" value="更换采集器导入模板 .xls" />
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=F:\TempImageFiles\;" />
<add key="FilePath_exl" value="E:\研发规划\00MES平台\MES_Manage(20170318)\MES_Manage" />
<add key="vs:EnableBrowserLink" value="false" />
</appSettings>
<!--<connectionStrings>
<appSettings>
-->
<!--<add key="ERP_ConnectionString" value="server=GYF;database=ERPTOOL;uid=sa;pwd=sa;Connection Reset=FALSE;Max Pool Size = 1000"/>-->
<!--
-->
<!--<add key="ERP_ConnectionString" value="server=LIJIALIN;database=ERPTOOL_HPP;uid=sa;pwd=sa;Connection Reset=FALSE;Max Pool Size = 1000"/>-->
<!--
-->
<!--<add key="ERP_ConnectionString" value="server=work1;database=ERPTOOL20110111;uid=sa;pwd=sa;Connection Reset=FALSE;Max Pool Size = 1000"/>-->
<!--
<add key="ERP_ConnectionString" value="server=PUHUI;database=HeatManageSystem;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000"/>
-->
<!--<add key="ERP_ConnectionString" value="server=GX;database=ERPTOOL20130117;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000"/>-->
<!--
-->
<!-- -->
<!--
-->
<!-- 报表模版文件路径 -->
<!--
<add key="reportTempDir" value="C:\报表程序\excel模版"/>
-->
<!-- 报表文件输出路径 -->
<!--
<add key="reportDir" value="C:\报表程序\excel输出"/>
-->
<!-- 报表模版文件 -->
<!--
<add key="reportTempFileName" value="报表模版.XLS"/>
</appSettings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>-->
<system.web>
<httpRuntime executionTimeout="90" maxRequestLength="40960" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" />
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
</system.web>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
</customHeaders>
</httpProtocol>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
<defaultDocument>
<files>
<add value="login.htm" />
</files>
</defaultDocument>
<validation validateIntegratedModeConfiguration="false" />
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>

57
localhost_10020.sln Normal file
View File

@@ -0,0 +1,57 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "http://localhost:10020", "http://localhost:10020", "{8885E35C-E781-4514-BE5F-2B269779D632}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "false"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
ProjectReferences = "{97127b87-d43d-457c-9894-5f2244e4d2e7}|DataLinkMesWork.dll;"
Debug.AspNetCompiler.VirtualPath = "/localhost_10020"
Debug.AspNetCompiler.PhysicalPath = "D:\项目管理\18.迈思\公司项目代码\getSql\通讯服务器20220629wdq\通讯服务器20220629\MES_Manage\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_10020\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_10020"
Release.AspNetCompiler.PhysicalPath = "D:\项目管理\18.迈思\公司项目代码\getSql\通讯服务器20220629wdq\通讯服务器20220629\MES_Manage\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_10020\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
SlnRelativePath = "D:\项目管理\18.迈思\公司项目代码\getSql\通讯服务器20220629wdq\通讯服务器20220629\MES_Manage\"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "02DataLinkMesWork", "..\02DataLinkMesWork\02DataLinkMesWork.csproj", "{97127B87-D43D-457C-9894-5F2244E4D2E7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "03.WriteExcelNPOI", "..\03.WriteExcelNPOI\03.WriteExcelNPOI.csproj", "{D7E149C7-A7E2-41C7-A3D3-AF5D2EFC9AF8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8885E35C-E781-4514-BE5F-2B269779D632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8885E35C-E781-4514-BE5F-2B269779D632}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8885E35C-E781-4514-BE5F-2B269779D632}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{8885E35C-E781-4514-BE5F-2B269779D632}.Release|Any CPU.Build.0 = Debug|Any CPU
{97127B87-D43D-457C-9894-5F2244E4D2E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97127B87-D43D-457C-9894-5F2244E4D2E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97127B87-D43D-457C-9894-5F2244E4D2E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97127B87-D43D-457C-9894-5F2244E4D2E7}.Release|Any CPU.Build.0 = Release|Any CPU
{D7E149C7-A7E2-41C7-A3D3-AF5D2EFC9AF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7E149C7-A7E2-41C7-A3D3-AF5D2EFC9AF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7E149C7-A7E2-41C7-A3D3-AF5D2EFC9AF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7E149C7-A7E2-41C7-A3D3-AF5D2EFC9AF8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2E15E713-0BF7-49DB-B842-15146A7B5EF6}
EndGlobalSection
EndGlobal

19
submit/Handler111.ashx Normal file
View File

@@ -0,0 +1,19 @@
<%@ WebHandler Language="C#" Class="Handler111" %>
using System;
using System.Web;
public class Handler111 : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
}
public bool IsReusable {
get {
return false;
}
}
}

View File

@@ -0,0 +1,231 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization.Json;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.Script.Serialization;
using System.Data;
public class JsonHelper
{
#region 序列化和反序列化
// 序列化
public static string JsonSerializer<T>(T t)
{
// 使用 DataContractJsonSerializer 将 T 对象序列化为内存流。
DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(T));
MemoryStream ms = new MemoryStream();
// 使用 WriteObject 方法将 JSON 数据写入到流中。
jsonSerializer.WriteObject(ms, t);
// 流转字符串
string jsonString = Encoding.UTF8.GetString(ms.ToArray());
ms.Close();
//替换Json的Date字符串
string p = @"\\/Date\((\d+)\+\d+\)\\/";
MatchEvaluator matchEvaluator = new MatchEvaluator(ConvertJsonDateToDateString);
Regex reg = new Regex(p);
jsonString = reg.Replace(jsonString, matchEvaluator);
return jsonString;
}
public static T JsonDeserialize<T>(string jsonString)
{
//将"yyyy-MM-dd HH:mm:ss"格式的字符串转为"\/Date(1294499956278+0800)\/"格式
string p = @"\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}";
MatchEvaluator matchEvaluator = new MatchEvaluator(ConvertDateStringToJsonDate);
Regex reg = new Regex(p);
jsonString = reg.Replace(jsonString, matchEvaluator);
DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(T));
// 字符串转流
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(jsonString));
// 通过使用 DataContractJsonSerializer 的 ReadObject 方法,将 JSON 编码数据反序列化为T
T obj = (T)jsonSerializer.ReadObject(ms);
return obj;
}
public static string ConvertJsonDateToDateString(Match match)
{
string result = string.Empty;
DateTime dateTime = new DateTime(1970, 1, 1);
dateTime = dateTime.AddMilliseconds(long.Parse(match.Groups[1].Value));
dateTime = dateTime.ToLocalTime();
result = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
return result;
}
private static string ConvertDateStringToJsonDate(Match m)
{
string result = string.Empty;
DateTime dt = DateTime.Parse(m.Groups[0].Value);
dt = dt.ToUniversalTime();
TimeSpan ts = dt - DateTime.Parse("1970-01-01");
result = string.Format("\\/Date({0}+0800)\\/", ts.TotalMilliseconds);
return result;
}
#endregion
// 对象转换为Json
public static string ObjectToJson(object obj)
{
JavaScriptSerializer js = new JavaScriptSerializer();
try
{
return js.Serialize(obj);
}
catch (Exception exception)
{
throw new Exception(exception.Message);
}
}
// 数据表转化为集合
public static List<Dictionary<string, object>> DataTableToList(DataTable dt)
{
List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
foreach (DataRow dataRow in dt.Rows)
{
Dictionary<string, object> dic = new Dictionary<string, object>();
foreach (DataColumn dc in dt.Columns)
{
dic.Add(dc.ColumnName, dataRow[dc.ColumnName]);
}
list.Add(dic);
}
return list;
}
// 表转换为Json
public static string DataTableToJson(DataTable dt)
{
return ObjectToJson(DataTableToList(dt));
}
/// <summary>
/// 将DataTable中的数据转换成JSON格式
/// </summary>
/// <param name="dt">数据源DataTable</param>
/// <param name="displayCount">是否输出数据总条数</param>
/// <param name="totalcount">JSON中显示的数据总条数</param>
/// <returns></returns>
public static string CreateJsonParameters(DataTable dt, bool displayCount, int totalcount)
{
StringBuilder JsonString = new StringBuilder();
//Exception Handling
if (dt != null)
{
JsonString.Append("{ ");
JsonString.Append("\"rows\":[ ");
for (int i = 0; i < dt.Rows.Count; i++)
{
JsonString.Append("{ ");
for (int j = 0; j < dt.Columns.Count; j++)
{
if (j < dt.Columns.Count - 1)
{
//if (dt.Rows[i][j] == DBNull.Value) continue;
if (dt.Columns[j].DataType == typeof(bool))
{
JsonString.Append("\"JSON_" + dt.Columns[j].ColumnName.ToLower() + "\":" +
dt.Rows[i][j].ToString().ToLower() + ",");
}
else if (dt.Columns[j].DataType == typeof(string))
{
JsonString.Append("\"JSON_" + dt.Columns[j].ColumnName.ToLower() + "\":" + "\"" +
dt.Rows[i][j].ToString().Replace("\"", "\\\"") + "\",");
}
else
{
JsonString.Append("\"JSON_" + dt.Columns[j].ColumnName.ToLower() + "\":" + "\"" + dt.Rows[i][j] + "\",");
}
}
else if (j == dt.Columns.Count - 1)
{
//if (dt.Rows[i][j] == DBNull.Value) continue;
if (dt.Columns[j].DataType == typeof(bool))
{
JsonString.Append("\"JSON_" + dt.Columns[j].ColumnName.ToLower() + "\":" +
dt.Rows[i][j].ToString().ToLower());
}
else if (dt.Columns[j].DataType == typeof(string))
{
JsonString.Append("\"JSON_" + dt.Columns[j].ColumnName.ToLower() + "\":" + "\"" +
dt.Rows[i][j].ToString().Replace("\"", "\\\"") + "\"");
}
else
{
JsonString.Append("\"JSON_" + dt.Columns[j].ColumnName.ToLower() + "\":" + "\"" + dt.Rows[i][j] + "\"");
}
}
}
/*end Of String*/
if (i == dt.Rows.Count - 1)
{
JsonString.Append("} ");
}
else
{
JsonString.Append("}, ");
}
}
JsonString.Append("]");
if (displayCount)
{
JsonString.Append(",");
JsonString.Append("\"total\":");
JsonString.Append(totalcount);
}
JsonString.Append("}");
return JsonString.ToString().Replace("\n", "");
}
else
{
return null;
}
}
StringBuilder result = new StringBuilder();
StringBuilder sb = new StringBuilder();
/// <summary>
/// 根据DataTable生成EasyUI Tree Json树结构
/// </summary>
/// <param name="tabel">数据源</param>
/// <param name="idCol">ID列</param>
/// <param name="txtCol">Text列</param>
/// <param name="url">节点Url</param>
/// <param name="rela">关系字段</param>
/// <param name="pId">父ID</param>
public string GetTreeJsonByTable(DataTable tabel, string idCol, string txtCol, string url, string rela, object pId)
{
result.Append(sb.ToString());
sb.Clear();
if (tabel.Rows.Count > 0)
{
sb.Append("[");
string filer = string.Format("{0}='{1}'", rela, pId);
DataRow[] rows = tabel.Select(filer);
if (rows.Length > 0)
{
foreach (DataRow row in rows)
{
sb.Append("{\"id\":\"" + row[idCol] + "\",\"text\":\"" + row[txtCol] + "\",\"attributes\":\"" + row[url] + "\",\"state\":\"open\"");
if (tabel.Select(string.Format("{0}='{1}'", rela, row[idCol])).Length > 0)
{
sb.Append(",\"children\":");
GetTreeJsonByTable(tabel, idCol, txtCol, url, rela, row[idCol]);
result.Append(sb.ToString());
sb.Clear();
}
result.Append(sb.ToString());
sb.Clear();
sb.Append("},");
}
sb = sb.Remove(sb.Length - 1, 1);
}
sb.Append("]");
result.Append(sb.ToString());
sb.Clear();
}
return result.ToString();
}
}

278
submit/MESCommonBase.ashx Normal file
View File

@@ -0,0 +1,278 @@
<%@ WebHandler Language = "C#" Class="MESCommonBase" %>
using System;
using System.Web;
using Newtonsoft.Json;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Web.Script.Serialization;
using System.Data;
using BasicData;
using DataLinkMesWork;
public class MESCommonBase : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "application/json";
var data = context.Request;
var stream = new StreamReader(data.InputStream).ReadToEnd();
string InvoiceNum;
//JsonData jsonData;
string responseText = "NULL";
byte[] bytes = null;
string fileName = "test.xsl";
try
{
JsonData jsonData=null;
try
{
jsonData = JsonMapper.ToObject(stream);
}
catch(Exception err)
{ }
int type=0;
try
{
if(jsonData!=null)
{
if(jsonData.ContainsKey("Type"))
{
type = Int32.Parse( jsonData["Type"].ToString());
}else if(jsonData.ContainsKey("type"))
{
type = Int32.Parse( jsonData["type"].ToString());
}
}
}
catch
{
}
jsonobj dataobj=null;
try
{
dataobj = new JavaScriptSerializer().Deserialize<jsonobj>(stream);
if(dataobj!=null)
{
type = Int32.Parse(dataobj.Type);
}
}
catch(Exception err)
{
dataobj = null;
}
if(dataobj==null)
{
try
{
InvoiceNum = HttpContext.Current.Request["param"];
if(InvoiceNum!=null)
{
jsonData = JsonMapper.ToObject(InvoiceNum);
if(jsonData.ContainsKey("Type"))
{
type = Int32.Parse( jsonData["Type"].ToString());
}else if(jsonData.ContainsKey("type"))
{
type = Int32.Parse( jsonData["type"].ToString());
}
}
}
catch
{
jsonData = null;
}
}
string fileExtension="";
HttpFileCollection files;
string suffix;
string name;
switch(type)
{
case 3001:
try
{
responseText = DataLinkMesWork.DbCallType1003_SqlCmd.SqlExec(dataobj.Param, jsonData);
}
catch (Exception err){}
context.Response.Write(responseText);
break;
case 2001:
//DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 2002:
//DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFilePdf(jsonData,out bytes,out fileName,out fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 2003:// 合成excel图片下载
string[] dataimg;
if(context.Request.Form.Keys.Count>0)
{
dataimg = data.Form.GetValues(0);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref dataimg[0]);
if (bytes == null) return;
fileName = fileName + "."+dataimg[0];
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(jsonData, out bytes, out fileName, out suffix);
//}
}
break;
case 2004:
//DataLink.LogJsonData(jsonData);
DataLinkMesWork.DataLink.ExePROCEDURE_Type2004(jsonData, out bytes, out fileName, out fileExtension);
//MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 15://上传文件
files = context.Request.Files;
if (files.Count > 0)
{
fileName = files[0].FileName;
bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
suffix = fileName.Substring(fileName.LastIndexOf(".")+1);
name = fileName.Substring(0,fileName.LastIndexOf("."));
responseText = DataLinkMesWork.DataLink.ExePROCEDURE_Type15(jsonData, name, suffix, bytes);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(jsonData, name, suffix, bytes);
//}
}
else
{
fileName = "";
bytes = new byte[1];
suffix = "";
name = "";
responseText = DataLinkMesWork.DataLink.ExePROCEDURE_Type15(jsonData, name, suffix, bytes);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(jsonData, name, suffix, bytes);
//}
}
break;
case 16://上传文件
DataLink.LogJsonData(jsonData);
DataLinkMesWork.DataLink.ExePROCEDURE_Type16(jsonData, out bytes, out fileName, out suffix);
if (bytes == null) return;
fileName = fileName + "."+suffix;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(jsonData, out bytes, out fileName, out suffix);
//}
break;
case 4000:
string userIP;
HttpRequest Request = HttpContext.Current.Request;
// 如果使用代理获取真实IP
if (context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != "")
userIP = context.Request.ServerVariables["REMOTE_ADDR"];
else
userIP = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (userIP == null || userIP == "")
userIP = context.Request.UserHostAddress;
context.Response.Write(userIP);
break;
default:
//DataLink.LogJsonData(jsonData);
responseText = DataLinkMesWork.DataLink.SqlWebCall(type,jsonData,dataobj);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.SqlWebCall_Bakup(type,jsonData,dataobj);
//}
break;
}
}
catch(Exception err)
{
context.Response.Write(responseText);
}
}
}

267
submit/MESCommonBase01.ashx Normal file
View File

@@ -0,0 +1,267 @@
<%@ WebHandler Language="C#" Class="MESCommonBase01" %>
using System;
using System.Web;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Web.Script.Serialization;
using System.Data;
//using BizDataAccess;
using System.Data.SqlClient;//<a href="uploadInvoiceScan.ashx">uploadInvoiceScan.ashx</a>
//using DbCallData;
using BasicData;
//using LitJson;
using DataLinkMesWork;
using System.Text.RegularExpressions;
public class MESCommonBase01 : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
string connType = "01";
context.Response.ContentType = "application/json";
var data = context.Request;
var stream = new StreamReader(data.InputStream).ReadToEnd();
string InvoiceNum;
//JsonData jsonData;
string responseText = "NULL";
byte[] bytes = null;
string fileName = "test.xsl";
try
{
JsonData jsonData=null;
try
{
jsonData = JsonMapper.ToObject(stream);
}
catch(Exception err)
{ }
int type=0;
try
{
if(jsonData!=null)
{
if(jsonData.ContainsKey("Type"))
{
type = Int32.Parse( jsonData["Type"].ToString());
}else if(jsonData.ContainsKey("type"))
{
type = Int32.Parse( jsonData["type"].ToString());
}
}
}
catch
{
}
jsonobj dataobj=null;
try
{
dataobj = new JavaScriptSerializer().Deserialize<jsonobj>(stream);
if(dataobj!=null)
{
type = Int32.Parse(dataobj.Type);
}
}
catch(Exception err)
{
dataobj = null;
}
if(dataobj==null)
{
try
{
InvoiceNum = HttpContext.Current.Request["param"];
if(InvoiceNum!=null)
{
jsonData = JsonMapper.ToObject(InvoiceNum);
if(jsonData.ContainsKey("Type"))
{
type = Int32.Parse( jsonData["Type"].ToString());
}else if(jsonData.ContainsKey("type"))
{
type = Int32.Parse( jsonData["type"].ToString());
}
}
}
catch
{
jsonData = null;
}
}
string fileExtension="";
HttpFileCollection files;
string suffix;
string name;
switch(type)
{
case 2001:
//DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 2002:
//DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFilePdf(jsonData,out bytes,out fileName,out fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 2003:// 合成excel图片下载
string[] dataimg;
if(context.Request.Form.Keys.Count>0)
{
dataimg = data.Form.GetValues(0);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref dataimg[0]);
if (bytes == null) return;
fileName = fileName + "."+dataimg[0];
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(jsonData, out bytes, out fileName, out suffix);
//}
}
break;
case 2004:
//DataLink.LogJsonData(jsonData);
DataLinkMesWork.DataLink.ExePROCEDURE_Type2004(connType,jsonData, out bytes, out fileName, out fileExtension);
//MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 15://上传文件
files = context.Request.Files;
if (files.Count > 0)
{
fileName = files[0].FileName;
bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
suffix = fileName.Substring(fileName.LastIndexOf(".")+1);
name = fileName.Substring(0,fileName.LastIndexOf("."));
responseText = DataLinkMesWork.DataLink.ExePROCEDURE_Type15(connType,jsonData, name, suffix, bytes);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(jsonData, name, suffix, bytes);
//}
}
else
{
fileName = "";
bytes = new byte[1];
suffix = "";
name = "";
responseText = DataLinkMesWork.DataLink.ExePROCEDURE_Type15(connType,jsonData, name, suffix, bytes);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(jsonData, name, suffix, bytes);
//}
}
break;
case 16://上传文件
DataLink.LogJsonData(jsonData);
DataLinkMesWork.DataLink.ExePROCEDURE_Type16(connType,jsonData, out bytes, out fileName, out suffix);
if (bytes == null) return;
fileName = fileName + "."+suffix;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(jsonData, out bytes, out fileName, out suffix);
//}
break;
default:
//DataLink.LogJsonData(jsonData);
responseText = DataLinkMesWork.DataLink.SqlWebCall(connType,type,jsonData,dataobj);//.SqlWebCall(stream);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.SqlWebCall_Bakup(type,jsonData,dataobj);
//}
break;
}
}
catch(Exception err)
{
context.Response.Write(responseText);
}
}
}

257
submit/MESCommonBase02.ashx Normal file
View File

@@ -0,0 +1,257 @@
<%@ WebHandler Language="C#" Class="MESCommonBase02" %>
using System;
using System.Web;
using System.IO;
using System.Web.Script.Serialization;
using BasicData;
using DataLinkMesWork;
public class MESCommonBase02 : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
string connType = "01";
context.Response.ContentType = "application/json";
var data = context.Request;
var stream = new StreamReader(data.InputStream).ReadToEnd();
string InvoiceNum;
//JsonData jsonData;
string responseText = "NULL";
byte[] bytes = null;
string fileName = "test.xsl";
try
{
JsonData jsonData=null;
try
{
jsonData = JsonMapper.ToObject(stream);
}
catch(Exception err)
{ }
int type=0;
try
{
if(jsonData!=null)
{
if(jsonData.ContainsKey("Type"))
{
type = Int32.Parse( jsonData["Type"].ToString());
}else if(jsonData.ContainsKey("type"))
{
type = Int32.Parse( jsonData["type"].ToString());
}
}
}
catch
{
}
jsonobj dataobj=null;
try
{
dataobj = new JavaScriptSerializer().Deserialize<jsonobj>(stream);
if(dataobj!=null)
{
type = Int32.Parse(dataobj.Type);
}
}
catch(Exception err)
{
dataobj = null;
}
if(dataobj==null)
{
try
{
InvoiceNum = HttpContext.Current.Request["param"];
if(InvoiceNum!=null)
{
jsonData = JsonMapper.ToObject(InvoiceNum);
if(jsonData.ContainsKey("Type"))
{
type = Int32.Parse( jsonData["Type"].ToString());
}else if(jsonData.ContainsKey("type"))
{
type = Int32.Parse( jsonData["type"].ToString());
}
}
}
catch
{
jsonData = null;
}
}
string fileExtension="";
HttpFileCollection files;
string suffix;
string name;
switch(type)
{
case 2001:
//DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 2002:
//DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFilePdf(jsonData,out bytes,out fileName,out fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 2003:// 合成excel图片下载
string[] dataimg;
if(context.Request.Form.Keys.Count>0)
{
dataimg = data.Form.GetValues(0);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref dataimg[0]);
if (bytes == null) return;
fileName = fileName + "."+dataimg[0];
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(jsonData, out bytes, out fileName, out suffix);
//}
}
break;
case 2004:
//DataLink.LogJsonData(jsonData);
DataLinkMesWork.DataLink.ExePROCEDURE_Type2004(connType,jsonData, out bytes, out fileName, out fileExtension);
//MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 15://上传文件
files = context.Request.Files;
if (files.Count > 0)
{
fileName = files[0].FileName;
bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
suffix = fileName.Substring(fileName.LastIndexOf(".")+1);
name = fileName.Substring(0,fileName.LastIndexOf("."));
responseText = DataLinkMesWork.DataLink.ExePROCEDURE_Type15(connType,jsonData, name, suffix, bytes);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(jsonData, name, suffix, bytes);
//}
}
else
{
fileName = "";
bytes = new byte[1];
suffix = "";
name = "";
responseText = DataLinkMesWork.DataLink.ExePROCEDURE_Type15(connType,jsonData, name, suffix, bytes);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(jsonData, name, suffix, bytes);
//}
}
break;
case 16://上传文件
DataLink.LogJsonData(jsonData);
DataLinkMesWork.DataLink.ExePROCEDURE_Type16(connType,jsonData, out bytes, out fileName, out suffix);
if (bytes == null) return;
fileName = fileName + "."+suffix;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(jsonData, out bytes, out fileName, out suffix);
//}
break;
default:
//DataLink.LogJsonData(jsonData);
responseText = DataLinkMesWork.DataLink.SqlWebCall(connType,type,jsonData,dataobj);//.SqlWebCall(stream);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.SqlWebCall_Bakup(type,jsonData,dataobj);
//}
break;
}
}
catch(Exception err)
{
context.Response.Write(responseText);
}
}
}

253
submit/MESCommonBase03.ashx Normal file
View File

@@ -0,0 +1,253 @@
<%@ WebHandler Language="C#" Class="MESCommonBase03" %>
using System;
using System.Web;
using System.IO;
using System.Web.Script.Serialization;
using BasicData;
using DataLinkMesWork;
public class MESCommonBase03 : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
string connType = "03";
context.Response.ContentType = "application/json";
var data = context.Request;
var stream = new StreamReader(data.InputStream).ReadToEnd();
string InvoiceNum;
//JsonData jsonData;
string responseText = "NULL";
byte[] bytes = null;
string fileName = "test.xsl";
try
{
JsonData jsonData=null;
try
{
jsonData = JsonMapper.ToObject(stream);
}
catch(Exception err)
{ }
int type=0;
try
{
if(jsonData!=null)
{
if(jsonData.ContainsKey("Type"))
{
type = Int32.Parse( jsonData["Type"].ToString());
}else if(jsonData.ContainsKey("type"))
{
type = Int32.Parse( jsonData["type"].ToString());
}
}
}
catch
{
}
jsonobj dataobj=null;
try
{
dataobj = new JavaScriptSerializer().Deserialize<jsonobj>(stream);
if(dataobj!=null)
{
type = Int32.Parse(dataobj.Type);
}
}
catch(Exception err)
{
dataobj = null;
}
if(dataobj==null)
{
try
{
InvoiceNum = HttpContext.Current.Request["param"];
if(InvoiceNum!=null)
{
jsonData = JsonMapper.ToObject(InvoiceNum);
if(jsonData.ContainsKey("Type"))
{
type = Int32.Parse( jsonData["Type"].ToString());
}else if(jsonData.ContainsKey("type"))
{
type = Int32.Parse( jsonData["type"].ToString());
}
}
}
catch
{
jsonData = null;
}
}
string fileExtension="";
HttpFileCollection files;
string suffix;
string name;
switch(type)
{
case 2001:
//DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 2002:
//DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFilePdf(jsonData,out bytes,out fileName,out fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 2003:// 合成excel图片下载
string[] dataimg;
if(context.Request.Form.Keys.Count>0)
{
dataimg = data.Form.GetValues(0);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref dataimg[0]);
if (bytes == null) return;
fileName = fileName + "."+dataimg[0];
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(jsonData, out bytes, out fileName, out suffix);
//}
}
break;
case 2004:
//DataLink.LogJsonData(jsonData);
DataLinkMesWork.DataLink.ExePROCEDURE_Type2004(connType,jsonData, out bytes, out fileName, out fileExtension);
//MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 15://上传文件
files = context.Request.Files;
if (files.Count > 0)
{
fileName = files[0].FileName;
bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
suffix = fileName.Substring(fileName.LastIndexOf(".")+1);
name = fileName.Substring(0,fileName.LastIndexOf("."));
responseText = DataLinkMesWork.DataLink.ExePROCEDURE_Type15(connType,jsonData, name, suffix, bytes);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(jsonData, name, suffix, bytes);
//}
}
else
{
fileName = "";
bytes = new byte[1];
suffix = "";
name = "";
responseText = DataLinkMesWork.DataLink.ExePROCEDURE_Type15(connType,jsonData, name, suffix, bytes);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(jsonData, name, suffix, bytes);
//}
}
break;
case 16://上传文件
DataLink.LogJsonData(jsonData);
DataLinkMesWork.DataLink.ExePROCEDURE_Type16(connType,jsonData, out bytes, out fileName, out suffix);
if (bytes == null) return;
fileName = fileName + "."+suffix;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(jsonData, out bytes, out fileName, out suffix);
//}
break;
default:
//DataLink.LogJsonData(jsonData);
responseText = DataLinkMesWork.DataLink.SqlWebCall(connType,type,jsonData,dataobj);//.SqlWebCall(stream);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.SqlWebCall_Bakup(type,jsonData,dataobj);
//}
break;
}
}
catch(Exception err)
{
context.Response.Write(responseText);
}
}
}

View File

@@ -0,0 +1,22 @@
<%@ WebHandler Language="C#" Class="MESCommonBase04" %>
using System.Web;
public class MESCommonBase04 : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
string connType = "04";
//ProcessRequestHttpContext.ProcessRequestServer.ProcessRequestHttpContext(connType, context);
}
}

209
submit/MESCommonBase05.ashx Normal file
View File

@@ -0,0 +1,209 @@
<%@ WebHandler Language="C#" Class="MESCommonBase05" %>
using System.Web;
public class MESCommonBase05 : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
string connType = "05";
//ProcessRequestHttpContext.ProcessRequestServer.ProcessRequestHttpContext(connType, context);
}
//public void ProcessRequestHttpContext(string connType,HttpContext context)
//{
// context.Response.ContentType = "application/json";
// var data = context.Request;
// var stream = new StreamReader(data.InputStream).ReadToEnd();
// string InvoiceNum;
// //JsonData jsonData;
// string responseText = "NULL";
// byte[] bytes = null;
// string fileName = "test.xsl";
// try
// {
// JsonData jsonData=null;
// try
// {
// jsonData = JsonMapper.ToObject(stream);
// }
// catch(Exception err)
// { }
// int type=0;
// try
// {
// if(jsonData!=null)
// {
// if(jsonData.ContainsKey("Type"))
// {
// type = Int32.Parse( jsonData["Type"].ToString());
// }else if(jsonData.ContainsKey("type"))
// {
// type = Int32.Parse( jsonData["type"].ToString());
// }
// }
// }
// catch
// {
// }
// jsonobj dataobj=null;
// try
// {
// dataobj = new JavaScriptSerializer().Deserialize<jsonobj>(stream);
// if(dataobj!=null)
// {
// type = Int32.Parse(dataobj.Type);
// }
// }
// catch(Exception err)
// {
// dataobj = null;
// }
// if(dataobj==null)
// {
// try
// {
// InvoiceNum = HttpContext.Current.Request["param"];
// if(InvoiceNum!=null)
// {
// jsonData = JsonMapper.ToObject(InvoiceNum);
// if(jsonData.ContainsKey("Type"))
// {
// type = Int32.Parse( jsonData["Type"].ToString());
// }else if(jsonData.ContainsKey("type"))
// {
// type = Int32.Parse( jsonData["type"].ToString());
// }
// }
// }
// catch
// {
// jsonData = null;
// }
// }
// string fileExtension;
// HttpFileCollection files;
// string suffix;
// string name;
// switch(type)
// {
// case 2001:
// DataLink.LogJsonData(connType,jsonData);
// MESDownloadExcel.ExcelWebCall.ExcelFile(connType,jsonData,out bytes,out fileName,out fileExtension);
// fileName = fileName + "."+fileExtension;
// HttpContext.Current.Response.ContentType = "application/octet-stream";
// //HttpContext.Current.Response.ContentType = getContentType(extension);
// //通知浏览器下载文件而不是打开
// HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
// HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
// HttpContext.Current.Response.BinaryWrite(bytes);
// HttpContext.Current.Response.Flush();
// HttpContext.Current.Response.End();
// break;
// case 2002:
// DataLink.LogJsonData(connType,jsonData);
// MESDownloadExcel.ExcelWebCall.ExcelFilePdf(connType,jsonData,out bytes,out fileName,out fileExtension);
// fileName = fileName + "."+fileExtension;
// HttpContext.Current.Response.ContentType = "application/octet-stream";
// //HttpContext.Current.Response.ContentType = getContentType(extension);
// //通知浏览器下载文件而不是打开
// HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
// HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
// HttpContext.Current.Response.BinaryWrite(bytes);
// HttpContext.Current.Response.Flush();
// HttpContext.Current.Response.End();
// break;
// case 15://上传文件
// files = context.Request.Files;
// if (files.Count > 0)
// {
// fileName = files[0].FileName;
// bytes = new byte[files[0].InputStream.Length];
// files[0].InputStream.Read(bytes, 0, bytes.Length);
// suffix = fileName.Split(new Char[] { '.' })[1];
// name = fileName.Split(new Char[] { '.' })[0];
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15(connType,jsonData, name, suffix, bytes);
// if(DataLinkMesWork.DataLink.isBakup=="1")
// {
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(connType,jsonData, name, suffix, bytes);
// }
// }
// else
// {
// fileName = "";
// bytes = new byte[1];
// suffix = "";
// name = "";
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15(connType,jsonData, name, suffix, bytes);
// if(DataLinkMesWork.DataLink.isBakup=="1")
// {
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(connType,jsonData, name, suffix, bytes);
// }
// }
// break;
// case 16://上传文件
// DataLink.LogJsonData(jsonData);
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16(connType,jsonData, out bytes, out fileName, out suffix);
// if (bytes == null) return;
// fileName = fileName + "."+suffix;
// HttpContext.Current.Response.ContentType = "application/octet-stream";
// //HttpContext.Current.Response.ContentType = getContentType(extension);
// //通知浏览器下载文件而不是打开
// HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
// HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
// HttpContext.Current.Response.BinaryWrite(bytes);
// HttpContext.Current.Response.Flush();
// HttpContext.Current.Response.End();
// if(DataLinkMesWork.DataLink.isBakup=="1")
// {
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(connType,jsonData, out bytes, out fileName, out suffix);
// }
// break;
// default:
// DataLink.LogJsonData(jsonData);
// responseText = DataLinkMesWork.DataLink.SqlWebCall(connType,type,jsonData,dataobj);//.SqlWebCall(stream);
// context.Response.Write(responseText);
// string isBakup= DataLinkMesWork.DataLink.GetIsBakupByConnType(connType);
// if(isBakup=="1")
// {
// DataLinkMesWork.DataLink.SqlWebCall_Bakup(connType,type,jsonData,dataobj);
// }
// break;
// }
// }
// catch(Exception err)
// {
// context.Response.Write(responseText);
// }
//}
}

254
submit/MESCommonBase06.ashx Normal file
View File

@@ -0,0 +1,254 @@
<%@ WebHandler Language="C#" Class="MESCommonBase06" %>
using System;
using System.Web;
using System.IO;
using System.Web.Script.Serialization;
using BasicData;
using DataLinkMesWork;
public class MESCommonBase06 : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
string connType = "06";
context.Response.ContentType = "application/json";
var data = context.Request;
var stream = new StreamReader(data.InputStream).ReadToEnd();
string InvoiceNum;
//JsonData jsonData;
string responseText = "NULL";
byte[] bytes = null;
string fileName = "test.xsl";
try
{
JsonData jsonData=null;
try
{
jsonData = JsonMapper.ToObject(stream);
}
catch(Exception err)
{ }
int type=0;
try
{
if(jsonData!=null)
{
if(jsonData.ContainsKey("Type"))
{
type = Int32.Parse( jsonData["Type"].ToString());
}else if(jsonData.ContainsKey("type"))
{
type = Int32.Parse( jsonData["type"].ToString());
}
}
}
catch
{
}
jsonobj dataobj=null;
try
{
dataobj = new JavaScriptSerializer().Deserialize<jsonobj>(stream);
if(dataobj!=null)
{
type = Int32.Parse(dataobj.Type);
}
}
catch(Exception err)
{
dataobj = null;
}
if(dataobj==null)
{
try
{
InvoiceNum = HttpContext.Current.Request["param"];
if(InvoiceNum!=null)
{
jsonData = JsonMapper.ToObject(InvoiceNum);
if(jsonData.ContainsKey("Type"))
{
type = Int32.Parse( jsonData["Type"].ToString());
}else if(jsonData.ContainsKey("type"))
{
type = Int32.Parse( jsonData["type"].ToString());
}
}
}
catch
{
jsonData = null;
}
}
string fileExtension="";
HttpFileCollection files;
string suffix;
string name;
switch(type)
{
case 2001:
//DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 2002:
//DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFilePdf(jsonData,out bytes,out fileName,out fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 2003:// 合成excel图片下载
string[] dataimg;
if(context.Request.Form.Keys.Count>0)
{
dataimg = data.Form.GetValues(0);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref dataimg[0]);
if (bytes == null) return;
fileName = fileName + "."+dataimg[0];
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(jsonData, out bytes, out fileName, out suffix);
//}
}
break;
case 2004:
//DataLink.LogJsonData(jsonData);
DataLinkMesWork.DataLink.ExePROCEDURE_Type2004(connType,jsonData, out bytes, out fileName, out fileExtension);
//MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 15://上传文件
files = context.Request.Files;
if (files.Count > 0)
{
fileName = files[0].FileName;
bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
suffix = fileName.Substring(fileName.LastIndexOf(".")+1);
name = fileName.Substring(0,fileName.LastIndexOf("."));
responseText = DataLinkMesWork.DataLink.ExePROCEDURE_Type15(connType,jsonData, name, suffix, bytes);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(jsonData, name, suffix, bytes);
//}
}
else
{
fileName = "";
bytes = new byte[1];
suffix = "";
name = "";
responseText = DataLinkMesWork.DataLink.ExePROCEDURE_Type15(connType,jsonData, name, suffix, bytes);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(jsonData, name, suffix, bytes);
//}
}
break;
case 16://上传文件
DataLink.LogJsonData(jsonData);
DataLinkMesWork.DataLink.ExePROCEDURE_Type16(connType,jsonData, out bytes, out fileName, out suffix);
if (bytes == null) return;
fileName = fileName + "."+suffix;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(jsonData, out bytes, out fileName, out suffix);
//}
break;
default:
//DataLink.LogJsonData(jsonData);
responseText = DataLinkMesWork.DataLink.SqlWebCall(connType,type,jsonData,dataobj);//.SqlWebCall(stream);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.SqlWebCall_Bakup(type,jsonData,dataobj);
//}
break;
}
}
catch(Exception err)
{
context.Response.Write(responseText);
}
}
}

254
submit/MESCommonBase07.ashx Normal file
View File

@@ -0,0 +1,254 @@
<%@ WebHandler Language="C#" Class="MESCommonBase07" %>
using System;
using System.Web;
using System.IO;
using System.Web.Script.Serialization;
using BasicData;
using DataLinkMesWork;
public class MESCommonBase07 : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
string connType = "07";
context.Response.ContentType = "application/json";
var data = context.Request;
var stream = new StreamReader(data.InputStream).ReadToEnd();
string InvoiceNum;
//JsonData jsonData;
string responseText = "NULL";
byte[] bytes = null;
string fileName = "test.xsl";
try
{
JsonData jsonData=null;
try
{
jsonData = JsonMapper.ToObject(stream);
}
catch(Exception err)
{ }
int type=0;
try
{
if(jsonData!=null)
{
if(jsonData.ContainsKey("Type"))
{
type = Int32.Parse( jsonData["Type"].ToString());
}else if(jsonData.ContainsKey("type"))
{
type = Int32.Parse( jsonData["type"].ToString());
}
}
}
catch
{
}
jsonobj dataobj=null;
try
{
dataobj = new JavaScriptSerializer().Deserialize<jsonobj>(stream);
if(dataobj!=null)
{
type = Int32.Parse(dataobj.Type);
}
}
catch(Exception err)
{
dataobj = null;
}
if(dataobj==null)
{
try
{
InvoiceNum = HttpContext.Current.Request["param"];
if(InvoiceNum!=null)
{
jsonData = JsonMapper.ToObject(InvoiceNum);
if(jsonData.ContainsKey("Type"))
{
type = Int32.Parse( jsonData["Type"].ToString());
}else if(jsonData.ContainsKey("type"))
{
type = Int32.Parse( jsonData["type"].ToString());
}
}
}
catch
{
jsonData = null;
}
}
string fileExtension="";
HttpFileCollection files;
string suffix;
string name;
switch(type)
{
case 2001:
//DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 2002:
//DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFilePdf(jsonData,out bytes,out fileName,out fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 2003:// 合成excel图片下载
string[] dataimg;
if(context.Request.Form.Keys.Count>0)
{
dataimg = data.Form.GetValues(0);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref dataimg[0]);
if (bytes == null) return;
fileName = fileName + "."+dataimg[0];
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(jsonData, out bytes, out fileName, out suffix);
//}
}
break;
case 2004:
//DataLink.LogJsonData(jsonData);
DataLinkMesWork.DataLink.ExePROCEDURE_Type2004(connType,jsonData, out bytes, out fileName, out fileExtension);
//MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName,ref fileExtension);
fileName = fileName + "."+fileExtension;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
case 15://上传文件
files = context.Request.Files;
if (files.Count > 0)
{
fileName = files[0].FileName;
bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
suffix = fileName.Substring(fileName.LastIndexOf(".")+1);
name = fileName.Substring(0,fileName.LastIndexOf("."));
responseText = DataLinkMesWork.DataLink.ExePROCEDURE_Type15(connType,jsonData, name, suffix, bytes);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(jsonData, name, suffix, bytes);
//}
}
else
{
fileName = "";
bytes = new byte[1];
suffix = "";
name = "";
responseText = DataLinkMesWork.DataLink.ExePROCEDURE_Type15(connType,jsonData, name, suffix, bytes);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type15_Bakup(jsonData, name, suffix, bytes);
//}
}
break;
case 16://上传文件
DataLink.LogJsonData(jsonData);
DataLinkMesWork.DataLink.ExePROCEDURE_Type16(connType,jsonData, out bytes, out fileName, out suffix);
if (bytes == null) return;
fileName = fileName + "."+suffix;
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.ExePROCEDURE_Type16_Bakup(jsonData, out bytes, out fileName, out suffix);
//}
break;
default:
//DataLink.LogJsonData(jsonData);
responseText = DataLinkMesWork.DataLink.SqlWebCall(connType,type,jsonData,dataobj);//.SqlWebCall(stream);
context.Response.Write(responseText);
//if(DataLinkMesWork.DataLink.isBakup=="1")
//{
// DataLinkMesWork.DataLink.SqlWebCall_Bakup(type,jsonData,dataobj);
//}
break;
}
}
catch(Exception err)
{
context.Response.Write(responseText);
} }
}

View File

@@ -0,0 +1,21 @@
<%@ WebHandler Language="C#" Class="MESCommonBase08" %>
using System.Web;
public class MESCommonBase08 : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
string connType = "08";
//ProcessRequestHttpContext.ProcessRequestServer.ProcessRequestHttpContext(connType, context);
}
}

View File

@@ -0,0 +1,21 @@
<%@ WebHandler Language="C#" Class="MESCommonBase09" %>
using System.Web;
public class MESCommonBase09 : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
string connType = "09";
//ProcessRequestHttpContext.ProcessRequestServer.ProcessRequestHttpContext(connType, context);
}
}

View File

@@ -0,0 +1,21 @@
<%@ WebHandler Language="C#" Class="MESCommonBase10" %>
using System.Web;
public class MESCommonBase10 : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public void ProcessRequest(HttpContext context)
{
string connType = "10";
//ProcessRequestHttpContext.ProcessRequestServer.ProcessRequestHttpContext(connType, context);
}
}

View File

@@ -0,0 +1,117 @@
<%@ WebHandler Language="C#" Class="DownloadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web.Script.Serialization;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using BasicData;
using DataLinkMesWork;
using MESDownloadExcel;
public class DownloadHandler : IHttpHandler
{
/// <summary>
/// 00 标准DataTable
/// 01 计划工时模板
/// 02 外协加工任务单
/// 03 外购备料请款
/// 04 自家项目报表
/// 05 材料清单
/// </summary>
/// <param name="context"></param>
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "application/json";
var data = context.Request;
var stream = new StreamReader(data.InputStream).ReadToEnd();
//JsonData jsonData;
//string responseText = "NULL";
byte[] bytes = null;
string fileName = "test.xsl";
try
{
string InvoiceNum = HttpContext.Current.Request["param"];
JsonData jsonData = JsonMapper.ToObject(InvoiceNum);
DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCall.ExcelFile(jsonData,out bytes,out fileName);
fileName = fileName + ".xls";
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
return;
}
catch (Exception ex)
{
return;
}
}
///// <summary>
///// Unicode编码(汉字转换为\uxxx)
///// </summary>
///// <param name="str"></param>
///// <returns></returns>
//public static string EnUnicode(string str)
//{
// StringBuilder strResult = new StringBuilder();
// if (!string.IsNullOrEmpty(str))
// {
// for (int i = 0; i < str.Length; i++)
// {
// strResult.Append("\\u");
// strResult.Append(((int)str[i]).ToString("x"));
// }
// }
// return strResult.ToString();
//}
///// <summary>
///// Unicode解码\uxxxx转换为汉字
///// </summary>
///// <param name="str"></param>
///// <returns></returns>
//public static string DeUnicode(string str)
//{
// //最直接的方法Regex.Unescape(str);
// Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})");
// return reg.Replace(str, delegate(Match m) { return ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString(); });
//}
// /// <summary>
///// Unicode解码
///// </summary>
///// <param name="str"></param>
///// <returns></returns>
//public static string DeUnicode(string str)
//{
// //最直接的方法Regex.Unescape(str);
// Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})");
// return reg.Replace(str, delegate (Match m) { return ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString(); });
//}
public bool IsReusable
{
get
{
return false;
}
}
}

View File

@@ -0,0 +1,117 @@
<%@ WebHandler Language="C#" Class="DownloadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web.Script.Serialization;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using BasicData;
using DataLinkMesWork;
using MESDownloadExcel;
public class DownloadHandler : IHttpHandler
{
/// <summary>
/// 00 标准DataTable
/// 01 计划工时模板
/// 02 外协加工任务单
/// 03 外购备料请款
/// 04 自家项目报表
/// 05 材料清单
/// </summary>
/// <param name="context"></param>
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "application/json";
var data = context.Request;
var stream = new StreamReader(data.InputStream).ReadToEnd();
//JsonData jsonData;
//string responseText = "NULL";
byte[] bytes = null;
string fileName = "test.xsl";
try
{
string InvoiceNum = HttpContext.Current.Request["param"];
JsonData jsonData = JsonMapper.ToObject(InvoiceNum);
DataLink.LogJsonData(jsonData);
MESDownloadExcel.ExcelWebCallDemo.ExcelFile(jsonData,out bytes,out fileName);
fileName = fileName + ".xls";
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
return;
}
catch (Exception ex)
{
return;
}
}
///// <summary>
///// Unicode编码(汉字转换为\uxxx)
///// </summary>
///// <param name="str"></param>
///// <returns></returns>
//public static string EnUnicode(string str)
//{
// StringBuilder strResult = new StringBuilder();
// if (!string.IsNullOrEmpty(str))
// {
// for (int i = 0; i < str.Length; i++)
// {
// strResult.Append("\\u");
// strResult.Append(((int)str[i]).ToString("x"));
// }
// }
// return strResult.ToString();
//}
///// <summary>
///// Unicode解码\uxxxx转换为汉字
///// </summary>
///// <param name="str"></param>
///// <returns></returns>
//public static string DeUnicode(string str)
//{
// //最直接的方法Regex.Unescape(str);
// Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})");
// return reg.Replace(str, delegate(Match m) { return ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString(); });
//}
// /// <summary>
///// Unicode解码
///// </summary>
///// <param name="str"></param>
///// <returns></returns>
//public static string DeUnicode(string str)
//{
// //最直接的方法Regex.Unescape(str);
// Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})");
// return reg.Replace(str, delegate (Match m) { return ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString(); });
//}
public bool IsReusable
{
get
{
return false;
}
}
}

View File

@@ -0,0 +1,52 @@
<%@ WebHandler Language="C#" Class="DownloadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
//using BizDataAccess;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
public class DownloadHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/part";
filePath = HttpContext.Current.Server.MapPath(filePath);
string id = HttpContext.Current.Request["id"];
filePath = filePath + "/" + id;
string name = HttpContext.Current.Request["name"];
try
{
System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Open);
byte[] bytes = new byte[(int)fs.Length];
fs.Read(bytes, 0, bytes.Length);
fs.Close();
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(name, System.Text.Encoding.UTF8));
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
return;
}
catch (Exception ex)
{
return;
}
}
public bool IsReusable
{
get
{
return false;
}
}
}

View File

@@ -0,0 +1,76 @@
<%@ WebHandler Language="C#" Class="MESCommonBase" %>
using System;
using System.Web;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Web.Script.Serialization;
using System.Data;
//using BizDataAccess;
using System.Data.SqlClient;
//using DbCallData;
//using BasicData;
using System.Net.Mail;
using System.Net.Mime;
using System.Timers;
using System.Xml;
using System.Net;
public class MESCommonBase : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
public int message;
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string Uid = HttpContext.Current.Request["Uid"];
string Key = HttpContext.Current.Request["Key"];
string smsMob = HttpContext.Current.Request["smsMob"];
string smsText = HttpContext.Current.Request["smsText"];
try
{
string url = "http://utf8.api.smschinese.cn/?Uid=" + Uid + "&Key=" + Key + "&smsMob=" + smsMob + "&smsText=" + smsText;
string relust = GetHtmlFromUrl(url);
context.Response.Write(Convert.ToInt16(relust));
}
catch (Exception ex)
{
return;
}
}
public string GetHtmlFromUrl(string url)
{
string strRet = null;
if(url==null || url.Trim().ToString()=="")
{
return strRet;
}
string targeturl = url.Trim().ToString();
try
{
HttpWebRequest hr = (HttpWebRequest)WebRequest.Create(targeturl);
hr.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
hr.Method = "GET";
hr.Timeout = 30 * 60 * 1000;
WebResponse hs = hr.GetResponse();
Stream sr = hs.GetResponseStream();
StreamReader ser = new StreamReader(sr, Encoding.Default);
strRet = ser.ReadToEnd();
}
catch (Exception ex)
{
strRet = null;
}
return strRet;
}
}

157
submit/MESUpload.ashx Normal file
View File

@@ -0,0 +1,157 @@
<%@ WebHandler Language="C#" Class="UploadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using DataLinkMesWork;
using System.Data.SqlClient;
public class UploadHandler : IHttpHandler
{
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/part";
filePath = HttpContext.Current.Server.MapPath(filePath);
string num = HttpContext.Current.Request["num"];
string tableName = HttpContext.Current.Request["tableName"];
string result = "";
bool isOK;
var stream = new StreamReader(context.Request.InputStream).ReadToEnd();
JsonData jsonData = JsonMapper.ToObject(stream);
//DataLink.LogJsonData(jsonData);
try
{
Guid guid = Guid.NewGuid();
string uid = guid.ToString().Replace("-", "").ToUpper();
HttpFileCollection files = context.Request.Files;
if (files.Count > 0)
{
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile hpFile = files[0];
if (hpFile.ContentLength > 0)
{
string fileName = System.IO.Path.GetFileName(hpFile.FileName);
string suffix = fileName.Split(new Char[] { '.' })[1];
string name = fileName.Split(new Char[] { '.' })[0];
string sql = "insert into " + tableName + " (num, uid, name, suffix, 是否启用) values(" + num + ",'" + uid + "','" + name + "','" + suffix + "'," + '1' + ")";
isOK =DataLinkMesWork.DataLink.ExecuteNonQuery(sql);
//--业务代码 1
//-- 1 发货管理_附件
//-- 2 合同信息管理_履约保证金_履约保函
//-- 3 合同管理_文件路径
//-- 4 PDM_机床总图_文件列表
//-- 5 采购管理_采购发票_附件
//-- 6 车间采购管理_发票结算申请单
//-- 7 设备管理_设备监控_图片
//-- 8 车间生产管理_质检管理
//-- 9 人员管理_图片
//--10 tableName
//SET ANSI_NULLS ON
//GO
//SET QUOTED_IDENTIFIER ON
//GO
//ALTER PROCEDURE [dbo].[_文件存储_高精_增加]
// @业务代码 int,
// @文件标识 int,
// @文件名称 nvarchar(150),
// @文件后缀 nvarchar(50),
// @文件内容 varbinary(max)
// as
//SET NOCOUNT ON;
//INSERT INTO [dbo].[_文件存储_高精](业务代码,[文件标识],[文件名称],[文件后缀],[文件内容])
// VALUES(@业务代码,@文件标识,@文件名称,@文件后缀,@文件内容)
//isOK = SQLCommon.ExecuteNonQuery(sql, connectionString, out result);
//isOK = SQLCommon.ExecuteNonQuery(sql, connectionString, out result);
if (isOK)
{
try
{
filePath = filePath + "/" + uid + "." + suffix;
hpFile.SaveAs(filePath);
result = "[{ \"result\":\"1\"}]";
}
catch
{
}
}
else
{
result = "[{ \"result\":\"0\"}]";
}
try
{
//增加文件保存到数据库的功能
byte[]bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
string procedureName = "_文件存储_高精_增加";
string errorMessage;
SqlParameter []thisParms = new SqlParameter[5];
thisParms[0] = new SqlParameter("@业务代码", 10);
thisParms[1] = new SqlParameter("@文件标识", uid);
thisParms[2] = new SqlParameter("@文件名称", name);
thisParms[3] = new SqlParameter("@文件后缀", suffix);
thisParms[4] = new SqlParameter("@文件内容", bytes);
DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName, ref thisParms, out errorMessage);
if(DataLinkMesWork.DataLink.isBakup=="1")
{
DataLinkMesWork.DataLink.ExecuteNonQuery_Bakup(sql);
DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName, ref thisParms, out errorMessage);
}
}
catch
{
}
}
else
{
context.Response.Write(result);
}
}
}
}
catch (Exception ex)
{
result = "[{ \"result\":\"0\"}]";
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}

103
submit/MESUploadFile.ashx Normal file
View File

@@ -0,0 +1,103 @@
<%@ WebHandler Language="C#" Class="UploadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using DataLinkMesWork;
using System.Data.SqlClient;
public class UploadHandler : IHttpHandler
{
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/part";
filePath = HttpContext.Current.Server.MapPath(filePath);
string num = HttpContext.Current.Request["num"];
string tableName = HttpContext.Current.Request["tableName"];
string result = "";
bool isOK;
try
{
Guid guid = Guid.NewGuid();
string uid = guid.ToString().Replace("-", "").ToUpper();
HttpFileCollection files = context.Request.Files;
if (files.Count > 0)
{
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile hpFile = files[0];
if (hpFile.ContentLength > 0)
{
string fileName = System.IO.Path.GetFileName(hpFile.FileName);
string suffix = fileName.Split(new Char[] { '.' })[1];
string name = fileName.Split(new Char[] { '.' })[0];
string sql = "insert into " + tableName + " (num, uid, name, suffix, 是否启用) values(" + num + ",'" + uid + "','" + name + "','" + suffix + "'," + '1' + ")";
isOK = DataLinkMesWork.DataLink.ExecuteNonQuery(sql);
//isOK = SQLCommon.ExecuteNonQuery(sql, connectionString, out result);
if (isOK)
{
filePath = filePath + "/" + uid + "." + suffix;
hpFile.SaveAs(filePath);
result = "[{ \"result\":\"1\"}]";
}
else
{
result = "[{ \"result\":\"0\"}]";
}
try
{
//增加文件保存到数据库的功能
byte[]bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
string procedureName = "_文件存储_高精_增加";
string errorMessage;
SqlParameter []thisParms = new SqlParameter[5];
thisParms[0] = new SqlParameter("@业务代码", 10);
thisParms[1] = new SqlParameter("@文件标识", uid);
thisParms[2] = new SqlParameter("@文件名称", name);
thisParms[3] = new SqlParameter("@文件后缀", suffix);
thisParms[4] = new SqlParameter("@文件内容", bytes);
DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName, ref thisParms, out errorMessage);
if(DataLinkMesWork.DataLink.isBakup=="1")
{
DataLinkMesWork.DataLink.ExecuteNonQuery_Bakup(sql);
}
}
catch
{
}
}
else
{
context.Response.Write(result);
}
}
}
}
catch (Exception ex)
{
result = "[{ \"result\":\"0\"}]";
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}

52
submit/downloadFile.ashx Normal file
View File

@@ -0,0 +1,52 @@
<%@ WebHandler Language="C#" Class="DownloadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
//using BizDataAccess;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
public class DownloadHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/file";
filePath = HttpContext.Current.Server.MapPath(filePath);
string id = HttpContext.Current.Request["id"];
filePath = filePath + "/" + id;
string name = HttpContext.Current.Request["name"];
try
{
System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Open);
byte[] bytes = new byte[(int)fs.Length];
fs.Read(bytes, 0, bytes.Length);
fs.Close();
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(name, System.Text.Encoding.UTF8));
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
return;
}
catch (Exception ex)
{
return;
}
}
public bool IsReusable
{
get
{
return false;
}
}
}

View File

@@ -0,0 +1,52 @@
<%@ WebHandler Language="C#" Class="DownloadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
//using BizDataAccess;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
public class DownloadHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/file";
filePath = HttpContext.Current.Server.MapPath(filePath);
string id = HttpContext.Current.Request["id"];
filePath = filePath + "/" + id;
string name = HttpContext.Current.Request["name"];
try
{
System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Open);
byte[] bytes = new byte[(int)fs.Length];
fs.Read(bytes, 0, bytes.Length);
fs.Close();
HttpContext.Current.Response.ContentType = "application/octet-stream";
//HttpContext.Current.Response.ContentType = getContentType(extension);
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(name, System.Text.Encoding.UTF8));
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
return;
}
catch (Exception ex)
{
return;
}
}
public bool IsReusable
{
get
{
return false;
}
}
}

View File

@@ -0,0 +1,164 @@
<%@ WebHandler Language="C#" Class="excel" %>
using System;
using System.Web;
using SystemFramework;
using WriteExcel;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using DataLinkMesWork;
public class excel : IHttpHandler {
HttpContext contextMesWebFun;
public void ProcessRequest (HttpContext context) {
string ss;
DataLinkMesWork.DataLink.InitSystem(out ss);
//if (!InitSystemReg(out resultReg))
//{
// return resultReg;
//}
contextMesWebFun = context; ;
context.Response.ContentType = "text/plain";
string type = contextMesWebFun.Request["type"];
string responseText = "";
byte[] bytes=null;
switch (type)
{
//扫描信息
case "Excel_NewArrivalList":
bytes= Excel_NewArrivalList();
HttpContext.Current.Response.ContentType = "application/ms-excel";
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "filename="+ HttpUtility.UrlEncode("OutsourcingMaterialsSearch.xls", System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
}
}
/// <summary>
/// 外购模板
/// </summary>
/// <returns></returns>
public byte[] Excel_NewArrivalList()
{
string value = null;
byte[] bytes=null;
try
{
System.Data.DataTable dt = null;
string folename = HttpContext.Current.Request["folename"];
string rec1 = HttpContext.Current.Request["rec1"];
string rec2 = HttpContext.Current.Request["rec2"];
string rec3 = HttpContext.Current.Request["rec3"];
string rec4 = HttpContext.Current.Request["rec4"];
List<string> str = new List<string>();
str.Add(rec1);
str.Add(rec2);
str.Add(rec3);
str.Add(rec4);
Hashtable ht=null;
pushHtDt1(str,out ht);
string sql = HttpContext.Current.Request["sql"];
Excel_NewArrivalList_SQL( out dt);
WriteExcel. Form1 frm = new Form1();
bytes = frm.demo1(folename, ht, dt);
}
catch (Exception err)
{
}
return bytes;
}
// 将固定参数传入哈希表
private void pushHtDt1(List<string> str ,out Hashtable htDt1)
{
htDt1 = new Hashtable();
for (int i = 0; i < str.Count; i++)
{
htDt1.Add(i, str[i].ToString());
}
}
static public void Excel_NewArrivalList_SQL(out DataTable dt)
{
ParamData[] paramData = new ParamData[1];
paramData[0].name = "到货单流水号";
paramData[0].value = "39";
string procedureName = "备料管理_到货单明细查询";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@到货单流水号", "39");
SqlCmd.ExecuteStoredProcedure(procedureName, ref paramData, out dt);
}
//public static bool ExecuteStoredProcedure(string procedureName, ref SqlParameter[] sqlParameters, out DataTable dt)
//{
// string errorMessage;
// DataSet ds;
// ExecuteStoredProcedure(procedureName, "server=192.168.1.140;database=ERPTOOL_GJ;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000", ref sqlParameters,out ds, out errorMessage);
// try
// {
// dt = ds.Tables[0];
// return true;
// }
// catch
// {
// dt = null;
// return false;
// }
//}
//public static bool ExecuteStoredProcedure(string procedureName, string connectionString, ref SqlParameter[] sqlParameters, out DataSet ds, out string errorMessage)
//{
// bool result = false;
// errorMessage = "";
// ds = new DataSet();
// using (SqlConnection conn = new SqlConnection(connectionString))
// {
// try
// {
// conn.Open();
// using (SqlDataAdapter dsCommand = new SqlDataAdapter())
// {
// dsCommand.SelectCommand = new SqlCommand(procedureName, conn);
// dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
// for (int i = 0; i < sqlParameters.Length; i++)
// {
// dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]);
// }
// dsCommand.Fill(ds);
// }
// result = true;
// }
// catch (Exception e)
// {
// errorMessage = e.ToString();
// //TestConnection();
// ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n存储过程\r\n" + procedureName + "\r\n连接字符串\r\n" + connectionString);
// }
// finally
// {
// if (conn.State == ConnectionState.Open)
// conn.Close();
// }
// }
// return result;
//}
public bool IsReusable {
get {
return false;
}
}
}

164
submit/excel.ashx.exclude Normal file
View File

@@ -0,0 +1,164 @@
<%@ WebHandler Language="C#" Class="excel" %>
using System;
using System.Web;
using SystemFramework;
using WriteExcel;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using DataLinkMesWork;
public class excel : IHttpHandler {
HttpContext contextMesWebFun;
public void ProcessRequest (HttpContext context) {
string ss;
DataLinkMesWork.DataLink.InitSystem(out ss);
//if (!InitSystemReg(out resultReg))
//{
// return resultReg;
//}
contextMesWebFun = context; ;
context.Response.ContentType = "text/plain";
string type = contextMesWebFun.Request["type"];
string responseText = "";
byte[] bytes=null;
switch (type)
{
//扫描信息
case "Excel_NewArrivalList":
bytes= Excel_NewArrivalList();
HttpContext.Current.Response.ContentType = "application/ms-excel";
//通知浏览器下载文件而不是打开
HttpContext.Current.Response.AddHeader("Content-Disposition", "filename="+ HttpUtility.UrlEncode("OutsourcingMaterialsSearch.xls", System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
break;
}
}
/// <summary>
/// 外购模板
/// </summary>
/// <returns></returns>
public byte[] Excel_NewArrivalList()
{
string value = null;
byte[] bytes=null;
try
{
System.Data.DataTable dt = null;
string folename = HttpContext.Current.Request["folename"];
string rec1 = HttpContext.Current.Request["rec1"];
string rec2 = HttpContext.Current.Request["rec2"];
string rec3 = HttpContext.Current.Request["rec3"];
string rec4 = HttpContext.Current.Request["rec4"];
List<string> str = new List<string>();
str.Add(rec1);
str.Add(rec2);
str.Add(rec3);
str.Add(rec4);
Hashtable ht=null;
pushHtDt1(str,out ht);
string sql = HttpContext.Current.Request["sql"];
Excel_NewArrivalList_SQL( out dt);
WriteExcel. Form1 frm = new Form1();
bytes = frm.demo1(folename, ht, dt);
}
catch (Exception err)
{
}
return bytes;
}
// 将固定参数传入哈希表
private void pushHtDt1(List<string> str ,out Hashtable htDt1)
{
htDt1 = new Hashtable();
for (int i = 0; i < str.Count; i++)
{
htDt1.Add(i, str[i].ToString());
}
}
static public void Excel_NewArrivalList_SQL(out DataTable dt)
{
ParamData[] paramData = new ParamData[1];
paramData[0].name = "到货单流水号";
paramData[0].value = "39";
string procedureName = "备料管理_到货单明细查询";
SqlParameter[] thisParms = new SqlParameter[1];
thisParms[0] = new System.Data.SqlClient.SqlParameter("@到货单流水号", "39");
SqlCmd.ExecuteStoredProcedure(procedureName, ref paramData, out dt);
}
//public static bool ExecuteStoredProcedure(string procedureName, ref SqlParameter[] sqlParameters, out DataTable dt)
//{
// string errorMessage;
// DataSet ds;
// ExecuteStoredProcedure(procedureName, "server=192.168.1.140;database=ERPTOOL_GJ;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000", ref sqlParameters,out ds, out errorMessage);
// try
// {
// dt = ds.Tables[0];
// return true;
// }
// catch
// {
// dt = null;
// return false;
// }
//}
//public static bool ExecuteStoredProcedure(string procedureName, string connectionString, ref SqlParameter[] sqlParameters, out DataSet ds, out string errorMessage)
//{
// bool result = false;
// errorMessage = "";
// ds = new DataSet();
// using (SqlConnection conn = new SqlConnection(connectionString))
// {
// try
// {
// conn.Open();
// using (SqlDataAdapter dsCommand = new SqlDataAdapter())
// {
// dsCommand.SelectCommand = new SqlCommand(procedureName, conn);
// dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
// for (int i = 0; i < sqlParameters.Length; i++)
// {
// dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]);
// }
// dsCommand.Fill(ds);
// }
// result = true;
// }
// catch (Exception e)
// {
// errorMessage = e.ToString();
// //TestConnection();
// ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n存储过程\r\n" + procedureName + "\r\n连接字符串\r\n" + connectionString);
// }
// finally
// {
// if (conn.State == ConnectionState.Open)
// conn.Close();
// }
// }
// return result;
//}
public bool IsReusable {
get {
return false;
}
}
}

View File

@@ -0,0 +1,322 @@
<%@ WebHandler Language="C#" Class="MESCommonBase" %>
using System;
using System.Web;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Web.Script.Serialization;
using System.Data;
using BizDataAccess;
using System.Data.SqlClient;
using DbCallData;
using BasicData;
public class MESCommonBase : IHttpHandler
{
public bool IsReusable
{
get
{
return false;
}
}
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "application/json";
var data = context.Request;
var stream = new StreamReader(data.InputStream).ReadToEnd();
var dataobj = new JavaScriptSerializer().Deserialize<jsonobj>(stream);
string responseText = "NULL";
try
{
responseText = DbCallData.DbCom.DbCall(dataobj);
context.Response.Write(responseText);
}
catch
{
context.Response.Write(responseText);
}
}
//有参数 没有返回值
//public static bool ExecuteStoredProcedure(string procedureName, string connectionString, ref SqlParameter[] sqlParameters, out string errorMessage)
//有参数 有返回值
//public static bool ExecuteStoredProcedure(string procedureName, string connectionString, ref SqlParameter[] sqlParameters, out DataSet ds, out string errorMessage)
//无参数 有返回值
//public static bool ExecuteStoredProcedure(string procedureName, string connectionString, out DataTable dt, out string errorMessage)
//public static bool ExecuteStoredProcedure(string procedureName, string connectionString, out DataSet ds, out string errorMessage)
/// <summary>
/// 执行存储过程
/// </summary>
/// <param name="json"></param>
/// <returns></returns>
//private string ExePROCEDURE(jsonobj json)
//{
// string result = "";
// DataSet ds = null;
// try
// {
// if (json.HasReturn)//执行有返回值的存储过程
// {
// if (json.Param == "" || json.Param == null)//执行没有参数的存储过程
// {
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, out ds, out result);
// }
// else//执行有参数的存储过程
// {
// string[] parmas;
// SqlParameter[] thisParms;
// try
// {
// parmas = json.Param.Split('|');
// thisParms = new SqlParameter[parmas.Length];
// for (int i = 0; i < parmas.Length; i++)
// {
// string[] pp = parmas[i].Split('&');
// object inputValue=null;
// if(pp.Length==3)
// {
// switch (pp[2])
// {
// case "Int":
// inputValue = Convert.ToInt32( pp[1]);
// break;
// case "String":
// inputValue = pp[2];
// break;
// case "Boolean":
// inputValue = Convert.ToBoolean( pp[1]);
// break;
// case "DateTime":
// inputValue = Convert.ToDateTime( pp[1]);
// break;
// default:
// inputValue = pp[1];
// break;
// }
// thisParms[i] = new SqlParameter(pp[0], inputValue);
// }
// else if(pp.Length==2)
// {
// thisParms[i] = new SqlParameter(pp[0], pp[1]);
// }
// }
// }
// catch (Exception)
// {
// return result = "参数有误,请检查参数的格式是否正确";
// }
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, ref thisParms, out ds, out result);
// }
// }
// else//执行没有返回值的存储过程
// {
// if (json.Param == "" || json.Param == null)//执行没有参数的存储过程
// {
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, out ds, out result);
// }
// else//执行有参数的存储过程
// {
// string[] parmas;
// SqlParameter[] thisParms;
// try
// {
// parmas = json.Param.Split('|');
// thisParms = new SqlParameter[parmas.Length];
// for (int i = 0; i < parmas.Length; i++)
// {
// string[] pp = parmas[i].Split('&');
// thisParms[i] = new SqlParameter(pp[0], pp[1]);
// }
// }catch (Exception)
// {
// return result = "参数有误,请检查参数的格式是否正确";
// }
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, ref thisParms, out result);
// }
// }
// if (ds != null && ds.Tables.Count > 0)
// {
// result = JsonHelper.DataTableToJson(ds.Tables[0]);
// }
// }
// catch (Exception ex)
// {
// result = ex.Message;
// }
// return result;
//}
/// <summary>
/// 执行存储过程 无返回值
/// </summary>
/// <param name="json"></param>
/// <returns></returns>
//private string ExePROCEDURE2(jsonobj json)
//{
// string result = "";
// DataSet ds = null;
// try
// {
// if (json.HasReturn)//执行有返回值的存储过程
// {
// if (json.Param == "" || json.Param == null)//执行没有参数的存储过程
// {
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, out ds, out result);
// }
// else//执行有参数的存储过程
// {
// string[] parmas;
// SqlParameter[] thisParms;
// try
// {
// parmas = json.Param.Split('|');
// thisParms = new SqlParameter[parmas.Length];
// for (int i = 0; i < parmas.Length; i++)
// {
// string[] pp = parmas[i].Split('&');
// object inputValue=null;
// if(pp.Length==3)
// {
// switch (pp[2])
// {
// case "Int":
// inputValue = Convert.ToInt32( pp[1]);
// break;
// case "String":
// inputValue = pp[2];
// break;
// case "Boolean":
// inputValue = Convert.ToBoolean( pp[1]);
// break;
// case "DateTime":
// inputValue = Convert.ToDateTime( pp[1]);
// break;
// default:
// inputValue = pp[1];
// break;
// }
// thisParms[i] = new SqlParameter(pp[0], inputValue);
// }
// else if(pp.Length==2)
// {
// thisParms[i] = new SqlParameter(pp[0], pp[1]);
// }
// }
// }
// catch (Exception)
// {
// return result = "参数有误,请检查参数的格式是否正确";
// }
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, ref thisParms, out ds, out result);
// }
// }
// else//执行没有返回值的存储过程
// {
// if (json.Param == "" || json.Param == null)//执行没有参数的存储过程
// {
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, out ds, out result);
// }
// else//执行有参数的存储过程
// {
// string[] parmas;
// SqlParameter[] thisParms;
// try
// {
// parmas = json.Param.Split('|');
// thisParms = new SqlParameter[parmas.Length];
// for (int i = 0; i < parmas.Length; i++)
// {
// string[] pp = parmas[i].Split('&');
// thisParms[i] = new SqlParameter(pp[0], pp[1]);
// }
// }catch (Exception)
// {
// return result = "参数有误,请检查参数的格式是否正确";
// }
// SQLCommon.ExecuteStoredProcedure(json.Name, connectionString, ref thisParms, out result);
// }
// }
// if (ds != null && ds.Tables.Count > 0)
// {
// result = JsonHelper.DataTableToJson(ds.Tables[0]);
// }
// }
// catch (Exception ex)
// {
// result = ex.Message;
// }
// return result;
//}
/// <summary>
/// 执行SQL语句
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
//private string ExeSQL(jsonobj obj)
//{
// string result = "";
// try
// {
// if (obj.HasReturn)//执行有返回值的sql
// {
// if (obj.Param == "")//执行没有参数的存储过程
// {
// //SQLCommon.ExecuteDataset();
// }
// else//执行有参数的存储过程
// {
// }
// }
// else//执行没有返回值的sql
// {
// if (obj.Param == "")//执行没有参数的存储过程
// {
// //SQLCommon.ExecuteStoredProcedure(obj.Name, connectionString, out ds, out result);
// }
// else//执行有参数的存储过程
// {
// }
// }
// }
// catch (Exception ex)
// {
// result = ex.Message;
// }
// return result;
//}
//[Serializable]
//class jsonobj
//{
// public string Type;
// public string Name;
// public string Param;
// public bool HasReturn;
//}
}

122
submit/upload2.ashx Normal file
View File

@@ -0,0 +1,122 @@
<%@ WebHandler Language="C#" Class="UploadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
//using BizDataAccess;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using DataLinkMesWork;
using System.Data.SqlClient;
public class UploadHandler : IHttpHandler
{
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/img";
filePath = HttpContext.Current.Server.MapPath(filePath);
string InvoiceNum = HttpContext.Current.Request["InvoiceNum"];
string result = "";
if(InvoiceNum == "null" || InvoiceNum == "" || InvoiceNum == "undefined")
{
result = "[{ \"result\":\"0\"}]";
context.Response.Write(result);
}
bool isOK;
try
{
Guid guid = Guid.NewGuid();
string uid = guid.ToString().Replace("-", "").ToUpper();
HttpFileCollection files = context.Request.Files;
if (files.Count > 0)
{
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile hpFile = files[0];
if (hpFile.ContentLength > 0)
{
string fileName = System.IO.Path.GetFileName(hpFile.FileName);
string suffix = fileName.Split(new Char[] { '.' })[1];
string Name = fileName.Split(new Char[] { '.' })[0];
string sql = "insert into 发货管理_附件 values(" + InvoiceNum + ",'" + uid + '.' + suffix + "','" + '1' + "')";
isOK = DataLinkMesWork.DataLink.ExecuteNonQuery(sql);
//--业务代码 1
//-- 1 发货管理_附件
//-- 2 合同信息管理_履约保证金_履约保函
//-- 3 合同管理_文件路径
//-- 4 PDM_机床总图_文件列表
//-- 5 采购管理_采购发票_附件
//-- 6 车间采购管理_发票结算申请单
//-- 7 设备管理_设备监控_图片
//-- 8 车间生产管理_质检管理
//-- 9 人员管理_图片
//--10 tableName
if (isOK)
{
filePath = filePath + "/" + uid + "." + suffix;
hpFile.SaveAs(filePath);
result = "[{ \"result\":\"1\"}]";
}
else
{
result = "[{ \"result\":\"0\"}]";
}
try
{
//增加文件保存到数据库的功能
byte[]bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
string procedureName = "_文件存储_高精_增加";
string errorMessage;
SqlParameter []thisParms = new SqlParameter[5];
thisParms[0] = new SqlParameter("@业务代码", 1);
thisParms[1] = new SqlParameter("@文件标识", uid);
thisParms[2] = new SqlParameter("@文件名称", Name);
thisParms[3] = new SqlParameter("@文件后缀", suffix);
thisParms[4] = new SqlParameter("@文件内容", bytes);
DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName, ref thisParms, out errorMessage);
if(DataLinkMesWork.DataLink.isBakup=="1")
{
DataLinkMesWork.DataLink.ExecuteNonQuery_Bakup(sql);
DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName, ref thisParms, out errorMessage);
}
}
catch
{
}
}
else
{
context.Response.Write(result);
}
}
}
}
catch (Exception ex)
{
result = "[{ \"result\":\"0\"}]";
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}

127
submit/upload3.ashx Normal file
View File

@@ -0,0 +1,127 @@
<%@ WebHandler Language="C#" Class="UploadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
//using BizDataAccess;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using DataLinkMesWork;
using System.Data.SqlClient;
public class UploadHandler : IHttpHandler
{
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/img";
filePath = HttpContext.Current.Server.MapPath(filePath);
string ProjectId = HttpContext.Current.Request["ProjectId"];
string result = "";
if(ProjectId == "null" || ProjectId == "" || ProjectId == "undefined")
{
result = "[{ \"result\":\"0\"}]";
context.Response.Write(result);
}
bool isOK;
try
{
Guid guid = Guid.NewGuid();
string uid = guid.ToString().Replace("-", "").ToUpper();
HttpFileCollection files = context.Request.Files;
if (files.Count > 0)
{
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile hpFile = files[0];
if (hpFile.ContentLength > 0)
{
string fileName = System.IO.Path.GetFileName(hpFile.FileName);
string suffix = fileName.Split(new Char[] { '.' })[1];
string Name = fileName.Split(new Char[] { '.' })[0];
string sql = "insert into 合同信息管理_履约保证金_履约保函 values(" + ProjectId + ",'" + uid + '.' + suffix + "','" + '1' + "')";
isOK = DataLinkMesWork.DataLink.ExecuteNonQuery(sql);
//--业务代码 1
//-- 1 发货管理_附件
//-- 2 合同信息管理_履约保证金_履约保函
//-- 3 合同管理_文件路径
//-- 4 PDM_机床总图_文件列表
//-- 5 采购管理_采购发票_附件
//-- 6 车间采购管理_发票结算申请单
//-- 7 设备管理_设备监控_图片
//-- 8 车间生产管理_质检管理
//-- 9 人员管理_图片
//--10 tableName
if (isOK)
{
filePath = filePath + "/" + uid + "." + suffix;
hpFile.SaveAs(filePath);
result = "[{ \"result\":\"1\"}]";
}
else
{
result = "[{ \"result\":\"0\"}]";
}
try
{
//增加文件保存到数据库的功能
byte[]bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
string procedureName = "_文件存储_高精_增加";
string errorMessage;
SqlParameter []thisParms = new SqlParameter[5];
thisParms[0] = new SqlParameter("@业务代码", 2);
thisParms[1] = new SqlParameter("@文件标识", uid);
thisParms[2] = new SqlParameter("@文件名称", Name);
thisParms[3] = new SqlParameter("@文件后缀", suffix);
thisParms[4] = new SqlParameter("@文件内容", bytes);
DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName, ref thisParms, out errorMessage);
if(DataLinkMesWork.DataLink.isBakup=="1")
{
DataLinkMesWork.DataLink.ExecuteNonQuery_Bakup(sql);
DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName, ref thisParms, out errorMessage);
}
}
catch
{
}
}
else
{
context.Response.Write(result);
}
}
}
}
catch (Exception ex)
{
result = "[{ \"result\":\"0\"}]";
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}

117
submit/uploadFile.ashx Normal file
View File

@@ -0,0 +1,117 @@
<%@ WebHandler Language="C#" Class="UploadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
//using BizDataAccess;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using DataLinkMesWork;
using System.Data.SqlClient;
public class UploadHandler : IHttpHandler
{
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/file";
filePath = HttpContext.Current.Server.MapPath(filePath);
string ProjectNum = HttpContext.Current.Request["ProjectNum"];
string result = "";
bool isOK;
try
{
Guid guid = Guid.NewGuid();
string uid = guid.ToString().Replace("-", "").ToUpper();
HttpFileCollection files = context.Request.Files;
if (files.Count > 0)
{
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile hpFile = files[0];
if (hpFile.ContentLength > 0)
{
string fileName = System.IO.Path.GetFileName(hpFile.FileName);
string suffix = fileName.Split(new Char[] { '.' })[1];
string Name = fileName.Split(new Char[] { '.' })[0];
string sql = "insert into 合同管理_文件路径 values(" + ProjectNum + ",'" + uid + "','" + Name + "','" + suffix + "'," + '1' + ")";
isOK = DataLinkMesWork.DataLink.ExecuteNonQuery(sql);
//--业务代码 1
//-- 1 发货管理_附件
//-- 2 合同信息管理_履约保证金_履约保函
//-- 3 合同管理_文件路径
//-- 4 PDM_机床总图_文件列表
//-- 5 采购管理_采购发票_附件
//-- 6 车间采购管理_发票结算申请单
//-- 7 设备管理_设备监控_图片
//-- 8 车间生产管理_质检管理
//-- 9 人员管理_图片
//--10 tableName
if (isOK)
{
filePath = filePath + "/" + uid + "." + suffix;
hpFile.SaveAs(filePath);
result = "[{ \"result\":\"1\"}]";
}
else
{
result = "[{ \"result\":\"0\"}]";
}
try
{
//增加文件保存到数据库的功能
byte[]bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
string procedureName = "_文件存储_高精_增加";
string errorMessage;
SqlParameter []thisParms = new SqlParameter[5];
thisParms[0] = new SqlParameter("@业务代码", 3);
thisParms[1] = new SqlParameter("@文件标识", uid);
thisParms[2] = new SqlParameter("@文件名称", Name);
thisParms[3] = new SqlParameter("@文件后缀", suffix);
thisParms[4] = new SqlParameter("@文件内容", bytes);
DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName, ref thisParms, out errorMessage);
if(DataLinkMesWork.DataLink.isBakup=="1")
{
DataLinkMesWork.DataLink.ExecuteNonQuery_Bakup(sql);
DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName, ref thisParms, out errorMessage);
}
}
catch
{
}
}
else
{
context.Response.Write(result);
}
}
}
}
catch (Exception ex)
{
result = "[{ \"result\":\"0\"}]";
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}

View File

@@ -0,0 +1,119 @@
<%@ WebHandler Language="C#" Class="UploadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
//using BizDataAccess;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using DataLinkMesWork;
using System.Data.SqlClient;
public class UploadHandler : IHttpHandler
{
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/file";
filePath = HttpContext.Current.Server.MapPath(filePath);
string MachineNum = HttpContext.Current.Request["MachineNum"];
string result = "";
bool isOK;
try
{
Guid guid = Guid.NewGuid();
string uid = guid.ToString().Replace("-", "").ToUpper();
HttpFileCollection files = context.Request.Files;
if (files.Count > 0)
{
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile hpFile = files[0];
if (hpFile.ContentLength > 0)
{
string fileName = System.IO.Path.GetFileName(hpFile.FileName);
string suffix = fileName.Split(new Char[] { '.' })[1];
string Name = fileName.Split(new Char[] { '.' })[0];
string sql = "insert into PDM_机床总图_文件列表 values(" + MachineNum + ",'" + uid + "','" + Name + "','" + suffix + "'," + '1' + ")";
isOK = DataLinkMesWork.DataLink.ExecuteNonQuery(sql);
//--业务代码 1
//-- 1 发货管理_附件
//-- 2 合同信息管理_履约保证金_履约保函
//-- 3 合同管理_文件路径
//-- 4 PDM_机床总图_文件列表
//-- 5 采购管理_采购发票_附件
//-- 6 车间采购管理_发票结算申请单
//-- 7 设备管理_设备监控_图片
//-- 8 车间生产管理_质检管理
//-- 9 人员管理_图片
//--10 tableName
if (isOK)
{
filePath = filePath + "/" + uid + "." + suffix;
hpFile.SaveAs(filePath);
result = "[{ \"result\":\"1\"}]";
}
else
{
result = "[{ \"result\":\"0\"}]";
}
try
{
//增加文件保存到数据库的功能
byte[]bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
string procedureName = "_文件存储_高精_增加";
string errorMessage;
SqlParameter []thisParms = new SqlParameter[5];
thisParms[0] = new SqlParameter("@业务代码", 4);
thisParms[1] = new SqlParameter("@文件标识", uid);
thisParms[2] = new SqlParameter("@文件名称", Name);
thisParms[3] = new SqlParameter("@文件后缀", suffix);
thisParms[4] = new SqlParameter("@文件内容", bytes);
DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName, ref thisParms, out errorMessage);
if(DataLinkMesWork.DataLink.isBakup=="1")
{
DataLinkMesWork.DataLink.ExecuteNonQuery_Bakup(sql);
DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName, ref thisParms, out errorMessage);
}
}
catch
{
}
}
else
{
context.Response.Write(result);
}
}
}
}
catch (Exception ex)
{
result = "[{ \"result\":\"0\"}]";
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}

View File

@@ -0,0 +1,165 @@
<%@ WebHandler Language="C#" Class="UploadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
//using BizDataAccess;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using System.Data.SqlClient;
using DataLinkMesWork;
public class UploadHandler : IHttpHandler
{
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/file";
filePath = HttpContext.Current.Server.MapPath(filePath);
string invoiceNum = HttpContext.Current.Request["invoiceNum"];
string money = HttpContext.Current.Request["money"];
string supplierValue = HttpContext.Current.Request["supplierValue"];
string paid = HttpContext.Current.Request["paid"];
string unpaid = HttpContext.Current.Request["unpaid"];
string tax = HttpContext.Current.Request["tax"];
string isCost = HttpContext.Current.Request["isCost"];
string remark = HttpContext.Current.Request["remark"];
int applyOrderNum = 0; // 发票结算申请单流水号
string result = "";
bool isOK1;
bool isOK2;
try
{
Guid guid = Guid.NewGuid();
string uid = guid.ToString().Replace("-", "").ToUpper();
HttpFileCollection files = context.Request.Files;
if (files.Count > 0)
{
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile hpFile = files[0];
if (hpFile.ContentLength > 0)
{
string fileName = System.IO.Path.GetFileName(hpFile.FileName);
string suffix = fileName.Split(new Char[] { '.' })[1];
string Name = fileName.Split(new Char[] { '.' })[0];
string procedureName = "采购管理_发票结算申请单_增加数据";
string errorMessage;
SqlParameter[] thisParms = new SqlParameter[9];
thisParms[0] = new SqlParameter("@发票结算申请单流水号", applyOrderNum);
thisParms[1] = new SqlParameter("@发票号", invoiceNum);
thisParms[2] = new SqlParameter("@发票金额", money);
thisParms[3] = new SqlParameter("@供应商流水号", supplierValue);
thisParms[4] = new SqlParameter("@已付款项", paid);
thisParms[5] = new SqlParameter("@尚欠金额", unpaid);
thisParms[6] = new SqlParameter("@税额", tax);
thisParms[7] = new SqlParameter("@是否费用类", isCost);
thisParms[8] = new SqlParameter("@备注", remark);
thisParms[0].Direction = ParameterDirection.Output;
isOK1 = DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName, ref thisParms, out errorMessage);
applyOrderNum = Convert.ToInt32(thisParms[0].Value);
//--业务代码 1
//-- 1 发货管理_附件
//-- 2 合同信息管理_履约保证金_履约保函
//-- 3 合同管理_文件路径
//-- 4 PDM_机床总图_文件列表
//-- 5 采购管理_采购发票_附件
//-- 6 车间采购管理_发票结算申请单
//-- 7 设备管理_设备监控_图片
//-- 8 车间生产管理_质检管理
//-- 9 人员管理_图片
//--10 tableName
if (isOK1)
{
string sql2 = "insert into 采购管理_采购发票_附件 values(" + applyOrderNum + ",'" + uid + "','" + Name + "','" + suffix + "'," + '1' + ")";
isOK2 = DataLinkMesWork.DataLink.ExecuteNonQuery(sql2);
if (isOK2)
{
filePath = filePath + "/" + uid + "." + suffix;
hpFile.SaveAs(filePath);
result = "[{ \"result\":\"1\"}]";
}
else
{
result = "[{ \"result\":\"0\"}]";
}
}
else
{
result = "[{ \"result\":\"0\"}]";
}
try
{
//增加文件保存到数据库的功能
byte[]bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
string procedureName1 = "_文件存储_高精_增加";
string errorMessage1;
SqlParameter []thisParms1 = new SqlParameter[5];
thisParms1[0] = new SqlParameter("@业务代码", 5);
thisParms1[1] = new SqlParameter("@文件标识", uid);
thisParms1[2] = new SqlParameter("@文件名称", Name);
thisParms1[3] = new SqlParameter("@文件后缀", suffix);
thisParms1[4] = new SqlParameter("@文件内容", bytes);
DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName1, ref thisParms1, out errorMessage1);
if(DataLinkMesWork.DataLink.isBakup=="1")
{
isOK1 = DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName, ref thisParms, out errorMessage);
applyOrderNum = Convert.ToInt32(thisParms[0].Value);
if (isOK1)
{
DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName1, ref thisParms1, out errorMessage1);
string sql2 = "insert into 采购管理_采购发票_附件 values(" + applyOrderNum + ",'" + uid + "','" + Name + "','" + suffix + "'," + '1' + ")";
isOK2 = DataLinkMesWork.DataLink.ExecuteNonQuery_Bakup(sql2);
}
else
{
//result = "[{ \"result\":\"0\"}]";
}
}
}
catch
{
}
}
else
{
context.Response.Write(result);
}
}
}
}
catch (Exception ex)
{
result = "[{ \"result\":\"0\"}]";
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}

View File

@@ -0,0 +1,183 @@
<%@ WebHandler Language="C#" Class="UploadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
//using BizDataAccess;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using System.Data.SqlClient;
using DataLinkMesWork;
public class UploadHandler : IHttpHandler
{
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/file";
filePath = HttpContext.Current.Server.MapPath(filePath);
string invoiceNum = HttpContext.Current.Request["invoiceNum"];
string money = HttpContext.Current.Request["money"];
string supplierValue = HttpContext.Current.Request["supplierValue"];
string paid = HttpContext.Current.Request["paid"];
string unpaid = HttpContext.Current.Request["unpaid"];
string tax = HttpContext.Current.Request["tax"];
string isCost = HttpContext.Current.Request["isCost"];
string remark = HttpContext.Current.Request["remark"];
int applyOrderNum = 0; // 发票结算申请单流水号
string result = "";
bool isOK1;
bool isOK2;
try
{
Guid guid = Guid.NewGuid();
string uid = guid.ToString().Replace("-", "").ToUpper();
HttpFileCollection files = context.Request.Files;
if (files.Count > 0)
{
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile hpFile = files[0];
if (hpFile.ContentLength > 0)
{
string fileName = System.IO.Path.GetFileName(hpFile.FileName);
string suffix = fileName.Split(new Char[] { '.' })[1];
string Name = fileName.Split(new Char[] { '.' })[0];
string procedureName = "车间采购管理_发票结算申请单_增加数据";
string errorMessage;
SqlParameter[] thisParms = new SqlParameter[9];
thisParms[0] = new SqlParameter("@发票结算申请单流水号", applyOrderNum);
thisParms[1] = new SqlParameter("@发票号", invoiceNum);
thisParms[2] = new SqlParameter("@发票金额", money);
thisParms[3] = new SqlParameter("@供应商流水号", supplierValue);
thisParms[4] = new SqlParameter("@已付款项", paid);
thisParms[5] = new SqlParameter("@尚欠金额", unpaid);
thisParms[6] = new SqlParameter("@税额", tax);
thisParms[7] = new SqlParameter("@是否费用类", isCost);
thisParms[8] = new SqlParameter("@备注", remark);
thisParms[0].Direction = ParameterDirection.Output;
isOK1 = SQLCommon.ExecuteStoredProcedure(procedureName, connectionString, ref thisParms, out errorMessage);
applyOrderNum = Convert.ToInt32(thisParms[0].Value);
//--业务代码 1
//-- 1 发货管理_附件
//-- 2 合同信息管理_履约保证金_履约保函
//-- 3 合同管理_文件路径
//-- 4 PDM_机床总图_文件列表
//-- 5 采购管理_采购发票_附件
//-- 6 车间采购管理_发票结算申请单
//-- 7 设备管理_设备监控_图片
//-- 8 车间生产管理_质检管理
//-- 9 人员管理_图片
//--10 tableName
if (isOK1)
{
string sql2 = "insert into 车间采购管理_采购发票_附件 values(" + applyOrderNum + ",'" + uid + "','" + Name + "','" + suffix + "'," + '1' + ")";
isOK2 = SQLCommon.ExecuteNonQuery(sql2, connectionString, out result);
if (isOK2)
{
filePath = filePath + "/" + uid + "." + suffix;
hpFile.SaveAs(filePath);
result = "[{ \"result\":\"1\"}]";
}
else
{
result = "[{ \"result\":\"0\"}]";
}
}
else
{
result = "[{ \"result\":\"0\"}]";
}
try
{
//增加文件保存到数据库的功能
byte[]bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
string procedureName1 = "_文件存储_高精_增加";
string errorMessage1;
SqlParameter []thisParms1 = new SqlParameter[5];
thisParms1[0] = new SqlParameter("@业务代码", 6);
thisParms1[1] = new SqlParameter("@文件标识", uid);
thisParms1[2] = new SqlParameter("@文件名称", Name);
thisParms1[3] = new SqlParameter("@文件后缀", suffix);
thisParms1[4] = new SqlParameter("@文件内容", bytes);
DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName1, ref thisParms1, out errorMessage1);
if(DataLinkMesWork.DataLink.isBakup=="1")
{
isOK1 = DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName, ref thisParms, out errorMessage);
applyOrderNum = Convert.ToInt32(thisParms[0].Value);
DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName1, ref thisParms1, out errorMessage1);
if (isOK1)
{
string sql2 = "insert into 车间采购管理_采购发票_附件 values(" + applyOrderNum + ",'" + uid + "','" + Name + "','" + suffix + "'," + '1' + ")";
isOK2 = DataLinkMesWork.DataLink.ExecuteNonQuery_Bakup(sql2);
if (isOK2)
{
//filePath = filePath + "/" + uid + "." + suffix;
//hpFile.SaveAs(filePath);
//result = "[{ \"result\":\"1\"}]";
}
else
{
//result = "[{ \"result\":\"0\"}]";
}
}
else
{
//result = "[{ \"result\":\"0\"}]";
}
}
}
catch
{
}
}
else
{
context.Response.Write(result);
}
}
}
}
catch (Exception ex)
{
result = "[{ \"result\":\"0\"}]";
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}

112
submit/uploadOP.ashx Normal file
View File

@@ -0,0 +1,112 @@
<%@ WebHandler Language="C#" Class="UploadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
//using BizDataAccess;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using System.Data.SqlClient;
using DataLinkMesWork;
public class UploadHandler : IHttpHandler
{
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/file";
filePath = HttpContext.Current.Server.MapPath(filePath);
string Num = HttpContext.Current.Request["num"];
string result = "";
bool isOK1;
try
{
Guid guid = Guid.NewGuid();
string uid = guid.ToString().Replace("-", "").ToUpper();
HttpFileCollection files = context.Request.Files;
HttpPostedFile hpFile = files[0];
string fileName = System.IO.Path.GetFileName(hpFile.FileName);
string suffix = fileName.Split(new Char[] { '.' })[1];
string Name = fileName.Split(new Char[] { '.' })[0];
string sql2 = "insert into 设备管理_设备监控_图片 values('" + Num + "','" + uid + "','" + Name + "','" + suffix + "'," + '1' + ")";
isOK1 = SQLCommon.ExecuteNonQuery(sql2, connectionString, out result);
if (isOK1)
{
filePath = filePath + "/" + uid + "." + suffix;
hpFile.SaveAs(filePath);
result = "[{ \"result\":\"1\"}]";
}
else
{
result = "[{ \"result\":\"0\"}]";
}
try
{
//增加文件保存到数据库的功能
byte[]bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
string procedureName = "_文件存储_高精_增加";
string errorMessage;
SqlParameter []thisParms = new SqlParameter[5];
thisParms[0] = new SqlParameter("@业务代码", 7);
thisParms[1] = new SqlParameter("@文件标识", uid);
thisParms[2] = new SqlParameter("@文件名称", Name);
thisParms[3] = new SqlParameter("@文件后缀", suffix);
thisParms[4] = new SqlParameter("@文件内容", bytes);
DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName, ref thisParms, out errorMessage);
//--业务代码 1
//-- 1 发货管理_附件
//-- 2 合同信息管理_履约保证金_履约保函
//-- 3 合同管理_文件路径
//-- 4 PDM_机床总图_文件列表
//-- 5 采购管理_采购发票_附件
//-- 6 车间采购管理_发票结算申请单
//-- 7 设备管理_设备监控_图片
//-- 8 车间生产管理_质检管理
//-- 9 人员管理_图片
//--10 tableName
if(DataLinkMesWork.DataLink.isBakup=="1")
{
DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName, ref thisParms, out errorMessage);
DataLinkMesWork.DataLink.ExecuteNonQuery_Bakup(sql2);
}
}
catch
{
}
}
catch (Exception ex)
{
result = "[{ \"result\":\"0\"}]";
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}

148
submit/uploadPDA.ashx Normal file
View File

@@ -0,0 +1,148 @@
<%@ WebHandler Language="C#" Class="UploadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
//using BizDataAccess;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using System.Data.SqlClient;
using DataLinkMesWork;
public class UploadHandler : IHttpHandler
{
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/file";
filePath = HttpContext.Current.Server.MapPath(filePath);
string number = HttpContext.Current.Request["number"];
string number1 = HttpContext.Current.Request["number1"];
string reasonsForNonconformity = HttpContext.Current.Request["reasonsForNonconformity"];
string disqualificationTreatment = HttpContext.Current.Request["disqualificationTreatment"];
string remark = HttpContext.Current.Request["remark"];
string num = HttpContext.Current.Request["num"];
string type = HttpContext.Current.Request["type"];
int qualifiedNum = 2; // 发票结算申请单流水号
string result = "";
bool isOK;
try
{
Guid guid = Guid.NewGuid();
string uid = guid.ToString().Replace("-", "").ToUpper();
HttpFileCollection files = context.Request.Files;
if (files.Count > 0)
{
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile hpFile = files[0];
if (hpFile.ContentLength > 0)
{
string fileName = System.IO.Path.GetFileName(hpFile.FileName);
string suffix = fileName.Split(new Char[] { '.' })[1];
string Name = fileName.Split(new Char[] { '.' })[0];
string procedureName = "车间生产管理_质检管理_不合格处理";
string errorMessage;
SqlParameter[] thisParms = new SqlParameter[12];
thisParms[0] = new SqlParameter("@零部件流水号", num);
thisParms[1] = new SqlParameter("@质检类型代码", type);
thisParms[2] = new SqlParameter("@数量", number);
thisParms[3] = new SqlParameter("@不合格数量", number1);
thisParms[4] = new SqlParameter("@是否合格", qualifiedNum);
thisParms[5] = new SqlParameter("@不合格原因", reasonsForNonconformity);
thisParms[6] = new SqlParameter("@不合格处理", disqualificationTreatment);
thisParms[7] = new SqlParameter("@备注", remark);
thisParms[8] = new SqlParameter("@文件标识", uid);
thisParms[9] = new SqlParameter("@文件名称", Name);
thisParms[10] = new SqlParameter("@文件后缀", suffix);
thisParms[11] = new SqlParameter("@是否启用", 1);
isOK = DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName, ref thisParms, out errorMessage);
try
{
if (isOK)
{
filePath = filePath + "/" + uid + "." + suffix;
hpFile.SaveAs(filePath);
result = "[{ \"result\":\"1\"}]";
}
else
{
result = "[{ \"result\":\"0\"}]";
}
try
{
//增加文件保存到数据库的功能
byte[]bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
string procedureName1 = "_文件存储_高精_增加";
string errorMessage1;
SqlParameter []thisParms1 = new SqlParameter[5];
thisParms1[0] = new SqlParameter("@业务代码", 8);
thisParms1[1] = new SqlParameter("@文件标识", uid);
thisParms1[2] = new SqlParameter("@文件名称", Name);
thisParms1[3] = new SqlParameter("@文件后缀", suffix);
thisParms1[4] = new SqlParameter("@文件内容", bytes);
DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName1, ref thisParms1, out errorMessage1);
//--业务代码 1
//-- 1 发货管理_附件
//-- 2 合同信息管理_履约保证金_履约保函
//-- 3 合同管理_文件路径
//-- 4 PDM_机床总图_文件列表
//-- 5 采购管理_采购发票_附件
//-- 6 车间采购管理_发票结算申请单
//-- 7 设备管理_设备监控_图片
//-- 8 车间生产管理_质检管理
//-- 9 人员管理_图片
//--10 tableName
if(DataLinkMesWork.DataLink.isBakup=="1")
{
DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName1, ref thisParms1, out errorMessage1);
DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName, ref thisParms, out errorMessage);
}
}
catch
{
}
}
catch
{
}
}
else
{
context.Response.Write(result);
}
}
}
}
catch (Exception ex)
{
result = "[{ \"result\":\"0\"}]";
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}

119
submit/uploadPerson.ashx Normal file
View File

@@ -0,0 +1,119 @@
<%@ WebHandler Language="C#" Class="UploadHandler" %>
using System;
using System.Web;
using System.Data;
using System.Collections.Generic;
using System.Linq;
//using BizDataAccess;
using System.IO;
using System.Net;
using System.Web.Services;
using System.Text;
using System.Data.SqlClient;
using DataLinkMesWork;
public class UploadHandler : IHttpHandler
{
private static string connectionString = System.Configuration.ConfigurationManager.AppSettings.GetValues("ConnectionString")[0].ToString();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string filePath = "../webpage/file";
filePath = HttpContext.Current.Server.MapPath(filePath);
string Num = HttpContext.Current.Request["num"];
string result = "";
bool isOK1;
try
{
Guid guid = Guid.NewGuid();
string uid = guid.ToString().Replace("-", "").ToUpper();
HttpFileCollection files = context.Request.Files;
HttpPostedFile hpFile = files[0];
string fileName = System.IO.Path.GetFileName(hpFile.FileName);
string suffix = fileName.Split(new Char[] { '.' })[1];
string Name = fileName.Split(new Char[] { '.' })[0];
string sql2 = "insert into 人员管理_图片 values(" + Num + ",'" + uid + "','" + Name + "','" + suffix + "'," + '1' + ")";
isOK1 = DataLinkMesWork.DataLink.ExecuteNonQuery(sql2);
try
{
//--业务代码 1
//-- 1 发货管理_附件
//-- 2 合同信息管理_履约保证金_履约保函
//-- 3 合同管理_文件路径
//-- 4 PDM_机床总图_文件列表
//-- 5 采购管理_采购发票_附件
//-- 6 车间采购管理_发票结算申请单
//-- 7 设备管理_设备监控_图片
//-- 8 车间生产管理_质检管理
//-- 9 人员管理_图片
//--10 tableName
if (isOK1)
{
filePath = filePath + "/" + uid + "." + suffix;
hpFile.SaveAs(filePath);
result = "[{ \"result\":\"1\"}]";
}
else
{
result = "[{ \"result\":\"0\"}]";
}
try
{
//增加文件保存到数据库的功能
byte[]bytes = new byte[files[0].InputStream.Length];
files[0].InputStream.Read(bytes, 0, bytes.Length);
string procedureName = "_文件存储_高精_增加";
string errorMessage;
SqlParameter []thisParms = new SqlParameter[5];
thisParms[0] = new SqlParameter("@业务代码", 9);
thisParms[1] = new SqlParameter("@文件标识", uid);
thisParms[2] = new SqlParameter("@文件名称", Name);
thisParms[3] = new SqlParameter("@文件后缀", suffix);
thisParms[4] = new SqlParameter("@文件内容", bytes);
DataLinkMesWork.DataLink.ExecuteStoredProcedure(procedureName, ref thisParms, out errorMessage);
if(DataLinkMesWork.DataLink.isBakup=="1")
{
DataLinkMesWork.DataLink.ExecuteStoredProcedure_Bakup(procedureName, ref thisParms, out errorMessage);
DataLinkMesWork.DataLink.ExecuteNonQuery_Bakup(sql2);
}
}
catch
{
}
}
catch
{
}
}
catch (Exception ex)
{
result = "[{ \"result\":\"0\"}]";
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}

13
submit/web.config Normal file
View File

@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="true"/>
</system.webServer>
<system.web>
<compilation>
<assemblies>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
</system.web>
</configuration>

68
webpage/ExcelDemo.html Normal file
View File

@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<script src="../JS/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
function btnTest() {
var param = '{"type":"' + $("#TYPE").val() + '","name":"' + $("#NAME").val() + '","param":"'+ $("#PARAM1value").val() + '"}'
console.log(param)
$.ajax({
url: $("#URL").val(),
type: 'POST',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: param,
success: function (data) {
$("#testResult").val(JSON.stringify(data));
},
error: function (data) {
$("#testResult").val('error');
}
});
}
</script>
<style>
.td{
width:400px;
}
input{
width:100%;
}
</style>
</head>
<body>
<table style="width:600px;">
<tr>
<td>URL:</td>
<td class=".td"><input id="URL" type="text" value="../submit/MESDownloadExcel.ashx" /></td>
</tr>
<tr>
<td>TYPE:</td>
<td class=".td"><input id="TYPE" type="text" />(11 查询 12 增删改)</td>
</tr>
<tr>
<td>NAME:</td>
<td class=".td"><input id="NAME" type="text" />(存储过程名称)</td>
</tr>
<tr>
<td>PARAM: </td>
<td class=".td"><input id="PARAM1value" type="text" value=""/>(存储过程参数)</td>
<h>PARAM示例[{\"name\":\"检测点代码\",\"value\":15},{\"name\":\"原材料_check\",\"value\":1},{\"name\":\"原材料代码\",\"value\":12}]</h>
</tr>
<tr>
<td>Pagination: </td>
<td class=".td"><input id="Pagination" type="text" />(分页的参数)</td>
</tr>
<tr>
<td><input type="button" onclick="btnTest()" value="testBtn" /></td>
</tr>
<tr style="height:400px;">
<td style="height:100%;" colspan="2">返回数据:<textarea id="testResult" style="width:100%;height:90%;" rows="30" cols="20"></textarea></td>
</tr>
</table>
</body>
</html>

95
webpage/SQLDemo.html Normal file
View File

@@ -0,0 +1,95 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<script src="../JS/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
//var URL = "";
//var SQLJson1 = {
// Type: "PROCEDURE",
// Name: "",
// Params: [
// { "当前工作日期": "2012-1-1" },
// ],
// HasReturn: true,
//}
//var SQLJson2 = {
// Type: "PROCEDURE",
// Name: "",
// Params: [
// { "当前工作日期": "2012-1-1" },
// ],
// HasReturn: true,
//}
function btnTest() {
var SQLJson2 = {
"Type": $("#TYPE").val(),
"Name": $("#NAME").val(),
"Param": $("#PARAM1value").val(),
"Pagination": $("#Pagination").val(),
"UserID": $("#NAME").val(),
HasReturn: $("#HASRETURN").get(0).checked
}
$.ajax({
url: $("#URL").val(),
type: 'POST',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: JSON.stringify(SQLJson2),
success: function (data) {
$("#testResult").text(JSON.stringify(data));
},
error: function (data) {
}
});
}
</script>
<style>
.td{
width:400px;
}
input{
width:100%;
}
</style>
</head>
<body>
<table style="width:600px;">
<tr>
<td>URL:</td>
<td class=".td"><input id="URL" type="text" value="../submit/MESCommonBase.ashx" /></td>
</tr>
<tr>
<td>TYPE:</td>
<td class=".td"><input id="TYPE" type="text" />(1 表示 执行存储过程 2 表示执行sql语句)</td>
</tr>
<tr>
<td>NAME:</td>
<td class=".td"><input id="NAME" type="text" />存储过程或者sql语句的名称</td>
</tr>
<tr>
<td>PARAM: </td>
<td class=".td"><input id="PARAM1value" type="text" />存储过程或者sql的语句的参数</td>
</tr>
<tr>
<td>Pagination: </td>
<td class=".td"><input id="Pagination" type="text" />(分页的参数)</td>
</tr>
<tr>
<td>返回值: <input style="display:inline" id="HASRETURN" type="checkbox" checked="checked" /></td>
<td></td>
</tr>
<tr>
<td><input type="button" onclick="btnTest()" value="testBtn" /></td>
</tr>
<tr style="height:400px;">
<td style="height:100%;" colspan="2">返回数据:<textarea id="testResult" style="width:100%;height:90%;" rows="30" cols="20"></textarea></td>
</tr>
</table>
</body>
</html>

106
webpage/SQLDemo04.html Normal file
View File

@@ -0,0 +1,106 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<script src="../JS/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
//var URL = "";
//var SQLJson1 = {
// Type: "PROCEDURE",
// Name: "",
// Params: [
// { "当前工作日期": "2012-1-1" },
// ],
// HasReturn: true,
//}
//var SQLJson2 = {
// Type: "PROCEDURE",
// Name: "",
// Params: [
// { "当前工作日期": "2012-1-1" },
// ],
// HasReturn: true,
//}
function btnTest() {
var SQLJson2 = {
"UserID": $("#UserID").val(),
"Type": $("#TYPE").val(),
"Name": $("#NAME").val(),
"Param": $("#PARAM1value").val(),
"Modular": $("#MODULARIDvalue").val(),
"Pagination": $("#Pagination").val(),
"ModularID": $("#MODULARIDvalue").val(),
HasReturn: $("#HASRETURN").get(0).checked
}
$.ajax({
url: $("#URL").val(),
type: 'POST',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: JSON.stringify(SQLJson2),
success: function (data) {
console.log(data, 111)
$("#testResult").text(JSON.stringify(data));
},
error: function (data) {
}
});
}
</script>
<style>
.td{
width:400px;
}
input{
width:100%;
}
</style>
</head>
<body>
<table style="width:600px;">
<tr>
<td>URL:</td>
<td class=".td"><input id="URL" type="text" value="../submit/MESCommonBase.ashx" /></td>
</tr>
<tr>
<td>USERID:</td>
<td class=".td"><input id="USERID" type="text" />(1 表示 执行存储过程 2 表示执行sql语句)</td>
</tr>
<tr>
<td>TYPE:</td>
<td class=".td"><input id="TYPE" type="text" />(1 表示 执行存储过程 2 表示执行sql语句)</td>
</tr>
<tr>
<td>NAME:</td>
<td class=".td"><input id="NAME" type="text" />存储过程或者sql语句的名称</td>
</tr>
<tr>
<td>PARAM: </td>
<td class=".td"><input id="PARAM1value" type="text" />存储过程或者sql的语句的参数</td>
</tr>
<tr>
<td>MODULARID: </td>
<td class=".td"><input id="MODULARIDvalue" type="text" />(主模块编号)</td>
</tr>
<tr>
<td>Pagination: </td>
<td class=".td"><input id="Pagination" type="text" />(分页的参数)</td>
</tr>
<tr>
<td>返回值: <input style="display:inline" id="HASRETURN" type="checkbox" checked="checked" /></td>
<td></td>
</tr>
<tr>
<td><input type="button" onclick="btnTest()" value="testBtn" /></td>
</tr>
<tr style="height:400px;">
<td style="height:100%;" colspan="2">返回数据:<textarea id="testResult" style="width:100%;height:90%;" rows="30" cols="20"></textarea></td>
</tr>
</table>
</body>
</html>

68
webpage/SQLDemo2.html Normal file
View File

@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<script src="../JS/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
function btnTest() {
var param = '{"type":"' + $("#TYPE").val() + '","name":"' + $("#NAME").val() + '","param":"'+ $("#PARAM1value").val() + '"}'
console.log(param)
$.ajax({
url: $("#URL").val(),
type: 'POST',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: param,
success: function (data) {
$("#testResult").val(JSON.stringify(data));
},
error: function (data) {
$("#testResult").val('error');
}
});
}
</script>
<style>
.td{
width:400px;
}
input{
width:100%;
}
</style>
</head>
<body>
<table style="width:600px;">
<tr>
<td>URL:</td>
<td class=".td"><input id="URL" type="text" value="../submit/MESCommonBase.ashx" /></td>
</tr>
<tr>
<td>TYPE:</td>
<td class=".td"><input id="TYPE" type="text" />(11 查询 12 增删改)</td>
</tr>
<tr>
<td>NAME:</td>
<td class=".td"><input id="NAME" type="text" />(存储过程名称)</td>
</tr>
<tr>
<td>PARAM: </td>
<td class=".td"><input id="PARAM1value" type="text" value=""/>(存储过程参数)</td>
<h>PARAM示例[{\"name\":\"检测点代码\",\"value\":15},{\"name\":\"原材料_check\",\"value\":1},{\"name\":\"原材料代码\",\"value\":12}]</h>
</tr>
<tr>
<td>Pagination: </td>
<td class=".td"><input id="Pagination" type="text" />(分页的参数)</td>
</tr>
<tr>
<td><input type="button" onclick="btnTest()" value="testBtn" /></td>
</tr>
<tr style="height:400px;">
<td style="height:100%;" colspan="2">返回数据:<textarea id="testResult" style="width:100%;height:90%;" rows="30" cols="20"></textarea></td>
</tr>
</table>
</body>
</html>

128
webpage/SQLDemo2Excel.html Normal file
View File

@@ -0,0 +1,128 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<script src="../JS/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
function btnTest() {
var param = '{"Type":"' + $("#TYPE").val() + '","UserID":"' + $("#USERID").val() + '","ModularID":"' + $("#MODULARID").val() + '","Name":"' + $("#NAME").val() + '","Param":"'+ $("#PARAM1value").val() + '"}'
console.log(param)
$.ajax({
url: $("#URL").val(),
type: 'POST',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: param,
success: function (data) {
$("#testResult").val(JSON.stringify(data));
},
error: function (data) {
$("#testResult").val('error');
}
});
}
// 导出
function downloadExcel() {
var param = '{"Type":"' + $("#TYPE").val() + '","UserID":"' + $("#USERID").val() + '","ModularID":"' + $("#MODULARID").val() + '","Name":"' + $("#NAME").val() + '","Param":"'+ $("#PARAM1value").val() + '"}'
const _ExcelDownLoad = '../submit/MESCommonBase.ashx'
download(`${_ExcelDownLoad}?param=${param}`)
};
// 导出Demo
function downloadExcelDemo() {
var param = '{"Type":"' + $("#TYPE").val() + '","UserID":"' + $("#USERID").val() + '","ModularID":"' + $("#MODULARID").val() + '","Name":"' + $("#NAME").val() + '","Param":"'+ $("#PARAM1value").val() + '"}'
const _ExcelDownLoad = '../submit/MESCommonBase.ashx'
download(`${_ExcelDownLoad}?param=${param}`)
};
function download(url) {
getBlob(url, function(blob, filename) {
saveAs(blob, filename)
})
};
function decodeUtf8(bytes) { var encoded = ""; for (var i = 0; i < bytes.length; i++) { encoded += '%' + bytes[i].toString(16); } return decodeURIComponent(encoded); }
function getBlob(url, cb) {
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.responseType = 'blob'
xhr.onload = function () {
if (xhr.status === 200) {
const name = xhr.getResponseHeader('content-disposition').split('=')[1]
var filename1 = decodeURIComponent(name)
cb(xhr.response, filename1)
}
}
xhr.send();
};
function saveAs(blob, filename = '下载文件.xls') {
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, filename)
} else {
var link = document.createElement('a')
var body = document.querySelector('body')
link.href = window.URL.createObjectURL(blob)
link.download = filename
// fix Firefox
link.style.display = 'none'
body.appendChild(link)
link.click()
body.removeChild(link)
window.URL.revokeObjectURL(link.href)
}
};
</script>
<style>
.td{
width:400px;
}
input{
width:100%;
}
</style>
</head>
<body>
<table style="width:600px;">
<tr>
<td>URL:</td>
<td class=".td"><input id="URL" type="text" value="../submit/MESCommonBase.ashx" /></td>
</tr>
<tr>
<td>USERID:</td>
<td class=".td"><input id="USERID" type="text" />(日志用)</td>
</tr>
<tr>
<td>TYPE:</td>
<td class=".td"><input id="TYPE" type="text" />(2001导出Excel报表11 查询 12 增删改)</td>
</tr>
<tr>
<td>NAME:</td>
<td class=".td"><input id="NAME" type="text" value="_T00" />(存储过程名称)</td>
</tr>
<tr>
<td>PARAM: </td>
<td class=".td"><input id="PARAM1value" type="text" value="" />(存储过程参数)</td>
<h>PARAM示例[{\"name\":\"检测点代码\",\"value\":15},{\"name\":\"原材料_check\",\"value\":1},{\"name\":\"原材料代码\",\"value\":12}]</h>
</tr>
<tr>
<td>MODULARID: </td>
<td class=".td"><input id="MODULARID" type="text" />(主模块编号)</td>
</tr>
<tr>
<td>Pagination: </td>
<td class=".td"><input id="Pagination" type="text" />(分页的参数)</td>
</tr>
<tr>
<td><input type="button" onclick="btnTest()" value="testBtn" /></td>
<td><input type="button" onclick="downloadExcel()" value="导出Excel" /></td>
<!--<td><input type="button" onclick="downloadExcelDemo()" value="导出ExcelDemo" /></td>-->
</tr>
<tr style="height:400px;">
<td style="height:100%;" colspan="2">返回数据:<textarea id="testResult" style="width:100%;height:90%;" rows="30" cols="20"></textarea></td>
</tr>
</table>
</body>
</html>

128
webpage/SQLDemoAMS.html Normal file
View File

@@ -0,0 +1,128 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<script src="../JS/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
function btnTest() {
var param = '{"Type":"' + $("#TYPE").val() + '","UserID":"' + $("#USERID").val() + '","ModularID":"' + $("#MODULARID").val() + '","Name":"' + $("#NAME").val() + '","Param":"'+ $("#PARAM1value").val() + '"}'
console.log(param)
$.ajax({
url: $("#URL").val(),
type: 'POST',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: param,
success: function (data) {
$("#testResult").val(JSON.stringify(data));
},
error: function (data) {
$("#testResult").val('error');
}
});
}
// 导出
function downloadExcel() {
var param = '{"Type":"' + $("#TYPE").val() + '","UserID":"' + $("#USERID").val() + '","ModularID":"' + $("#MODULARID").val() + '","Name":"' + $("#NAME").val() + '","Param":"'+ $("#PARAM1value").val() + '"}'
const _ExcelDownLoad = '../submit/MESCommonBase.ashx'
download(`${_ExcelDownLoad}?param=${param}`)
};
// 导出Demo
function downloadExcelDemo() {
var param = '{"Type":"' + $("#TYPE").val() + '","UserID":"' + $("#USERID").val() + '","ModularID":"' + $("#MODULARID").val() + '","Name":"' + $("#NAME").val() + '","Param":"'+ $("#PARAM1value").val() + '"}'
const _ExcelDownLoad = '../submit/MESCommonBase.ashx'
download(`${_ExcelDownLoad}?param=${param}`)
};
function download(url) {
getBlob(url, function(blob, filename) {
saveAs(blob, filename)
})
};
function decodeUtf8(bytes) { var encoded = ""; for (var i = 0; i < bytes.length; i++) { encoded += '%' + bytes[i].toString(16); } return decodeURIComponent(encoded); }
function getBlob(url, cb) {
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.responseType = 'blob'
xhr.onload = function () {
if (xhr.status === 200) {
const name = xhr.getResponseHeader('content-disposition').split('=')[1]
var filename1 = decodeURIComponent(name)
cb(xhr.response, filename1)
}
}
xhr.send();
};
function saveAs(blob, filename = '下载文件.xls') {
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, filename)
} else {
var link = document.createElement('a')
var body = document.querySelector('body')
link.href = window.URL.createObjectURL(blob)
link.download = filename
// fix Firefox
link.style.display = 'none'
body.appendChild(link)
link.click()
body.removeChild(link)
window.URL.revokeObjectURL(link.href)
}
};
</script>
<style>
.td{
width:400px;
}
input{
width:100%;
}
</style>
</head>
<body>
<table style="width:600px;">
<tr>
<td>URL:</td>
<td class=".td"><input id="URL" type="text" value="../submit/MESCommonBaseAMS.ashx" /></td>
</tr>
<tr>
<td>USERID:</td>
<td class=".td"><input id="USERID" type="text" />(日志用)</td>
</tr>
<tr>
<td>TYPE:</td>
<td class=".td"><input id="TYPE" type="text" />(2001导出Excel报表11 查询 12 增删改)</td>
</tr>
<tr>
<td>NAME:</td>
<td class=".td"><input id="NAME" type="text" value="_T00" />(存储过程名称)</td>
</tr>
<tr>
<td>PARAM: </td>
<td class=".td"><input id="PARAM1value" type="text" value="" />(存储过程参数)</td>
<h>PARAM示例[{\"name\":\"检测点代码\",\"value\":15},{\"name\":\"原材料_check\",\"value\":1},{\"name\":\"原材料代码\",\"value\":12}]</h>
</tr>
<tr>
<td>MODULARID: </td>
<td class=".td"><input id="MODULARID" type="text" />(主模块编号)</td>
</tr>
<tr>
<td>Pagination: </td>
<td class=".td"><input id="Pagination" type="text" />(分页的参数)</td>
</tr>
<tr>
<td><input type="button" onclick="btnTest()" value="testBtn" /></td>
<td><input type="button" onclick="downloadExcel()" value="导出Excel" /></td>
<!--<td><input type="button" onclick="downloadExcelDemo()" value="导出ExcelDemo" /></td>-->
</tr>
<tr style="height:400px;">
<td style="height:100%;" colspan="2">返回数据:<textarea id="testResult" style="width:100%;height:90%;" rows="30" cols="20"></textarea></td>
</tr>
</table>
</body>
</html>

96
webpage/SQLDemoFile.html Normal file
View File

@@ -0,0 +1,96 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<script src="../JS/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
$(function () {
form.reset();
var file;
$("#form").on("change", "#file", function (e) {
console.log(this.value);
//每次选中都保存旧元素,并使用新的控件替换
$(this).clone().replaceAll(file = this);
}).submit(function () {
//提交时把之前保存的旧元素替换回去
$("#file").replaceWith(file);
});
});
function btnTest() {
var SQLJson2 = {
"Type": $("#TYPE").val(),
"Name": $("#NAME").val(),
"Param": $("#PARAM1value").val(),
"Pagination": $("#Pagination").val(),
"UserID": $("#NAME").val(),
HasReturn: $("#HASRETURN").get(0).checked
}
$.ajax({
url: $("#URL").val(),
type: 'POST',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: JSON.stringify(SQLJson2),
success: function (data) {
$("#testResult").text(JSON.stringify(data));
},
error: function (data) {
}
});
}
</script>
<style>
.td{
width:400px;
}
input{
width:100%;
}
</style>
</head>
<body>
<form id="form">
<input type="file" name="file" id="file">
<input type="submit" />
</form>
<table style="width:600px;">
<tr>
<td>URL:</td>
<td class=".td"><input id="URL" type="text" value="../submit/MESCommonBase.ashx" /></td>
</tr>
<tr>
<td>TYPE:</td>
<td class=".td"><input id="TYPE" type="text" />(1 表示 执行存储过程 2 表示执行sql语句)</td>
</tr>
<tr>
<td>NAME:</td>
<td class=".td"><input id="NAME" type="text" />存储过程或者sql语句的名称</td>
</tr>
<tr>
<td>PARAM: </td>
<td class=".td"><input id="PARAM1value" type="text" />存储过程或者sql的语句的参数</td>
</tr>
<tr>
<td>Pagination: </td>
<td class=".td"><input id="Pagination" type="text" />(分页的参数)</td>
</tr>
<tr>
<td>返回值: <input style="display:inline" id="HASRETURN" type="checkbox" checked="checked" /></td>
<td></td>
</tr>
<tr>
<td><input type="button" onclick="btnTest()" value="testBtn" /></td>
</tr>
<tr style="height:400px;">
<td style="height:100%;" colspan="2">返回数据:<textarea id="testResult" style="width:100%;height:90%;" rows="30" cols="20"></textarea></td>
</tr>
</table>
</body>
</html>

402
webpage/SqlCommonDemo.htm Normal file
View File

@@ -0,0 +1,402 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link rel="stylesheet" type="text/css" href="../css/upload.css" />
<link href="../js/jquery.uploadify-v2.1.0/uploadify.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../js/jquery-easyui-1.3.4/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../js/jquery.uploadify-v2.1.0/swfobject.js" type="text/javascript"></script>
<script src="../js/jquery.uploadify-v2.1.0/jquery.uploadify.v2.1.0.js" type="text/javascript"></script>
<link href="../js/jquery-easyui-1.3.4/themes/default/easyui.css" rel="stylesheet"
type="text/css" />
<link href="../js/jquery-easyui-1.3.4/themes/icon.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery-easyui-1.3.4/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<link href="../css/sexybuttons.css" rel="stylesheet" type="text/css" />
<link href="../css/icon.css" rel="stylesheet" type="text/css" />
<link href="../css/common.css" rel="stylesheet" type="text/css" />
<script src="../js/imageupload.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
Init_role();
InitGrid();
});
function InitGrid() {
datagrid_collector = $('#datagrid_collector').datagrid({
url: '../submit/UserManage.ashx?type=Select',
title: '用户信息',
pagination: true, //显示分页工具条
pageSize: 10,
pageList: [10, 20, 30, 40], //,checkbox:true fit: true,
sortName: 'JSON_用户编号', //按哪个字段排序,将把这个提交给服务器
sortOrder: 'desc', //升序降序
fitColumns: true, //当横向数据多时是否会出现挤压。即是否会出现横向滚动条。如果想冻结列就得把这个属性设为false,如果为true会自动对齐数据列宽。当列多时就设为false。
nowarp: false, //当一个表格中数据过多时,是否会出现
idField: 'JSON_用户编号',
columns: [[
{ title: '用户编号', field: 'JSON_用户编号', width: 120, align: 'center', checkbox: true },
{ title: '用户名', field: 'JSON_用户名', width: 200, align: 'center' },
{ title: '密码', field: 'JSON_密码', width: 200, align: 'center' },
{ title: '用户姓名', field: 'JSON_用户姓名', width: 120, align: 'center' },
{ title: '员工编号', field: 'JSON_员工编号', width: 120, align: 'center' },
{ title: '班组', field: 'JSON_班组', width: 120, align: 'center' },
{ title: '工作岗位', field: 'JSON_工作岗位', width: 120, align: 'center' },
{ title: '联系电话', field: 'JSON_联系电话', width: 300, align: 'center' },
{ title: '角色编号', field: 'JSON_角色编号', width: 300, align: 'center' },
{ title: '角色名称', field: 'JSON_角色名称', width: 300, align: 'center' }
]],
onClickRow: function (rowIndex, rowData) {
userNum = rowData["JSON_用户编号"];
showpic(userNum);
},
toolbar: '#tab_toolbar'
});
}
//提交dialog
function submitCollectorForm() {
var Falg = $('#Hidden_editflag').val();
var url1;
var rows = $('#datagrid_collector').datagrid('getSelections');
if (Falg == 2) {
url1 = "../submit/UserManage.ashx?type=editCollector&selectId=" + rows[0].JSON_用户编号 + "&UserName=" + $('#UserName').val() + "&UserNum=" + $('#UserNum').val() + "&password=" + $('#password').val() + "&workernum=" + $('#workernum').val() + "&groupnum=" + $('#groupnum').val() + "&position=" + $('#position').val() + "&phoneNum=" + $('#phoneNum').val() + "&role=" + $('#role').combobox('getValue');
$.ajax({
type: "POST",
url: url1,
success: function (r) {
r = eval("(" + r + ")"); //注意要转化为对象
if (r.result == "1") {
$.messager.alert('提示信息', '数据处理成功');
$('#edit').dialog('close');
InitGrid();
}
else {
$.messager.alert('Warning', '失败!');
}
}
})
}
else {
url1 = "../submit/UserManage.ashx?type=addCollector&UserName=" + $('#UserName').val() + "&UserNum=" + $('#UserNum').val() + "&password=" + $('#password').val() + "&workernum=" + $('#workernum').val() + "&groupnum=" + $('#groupnum').val() + "&position=" + $('#position').val() + "&phoneNum=" + $('#phoneNum').val() + "&role=" + $('#role').combobox('getValue');
$.ajax({
type: "POST",
url: url1,
success: function (r) {
r = eval("(" + r + ")"); //注意要转化为对象
if (r.result == "1") {
$.messager.alert('提示信息', '数据处理成功');
$('#edit').dialog('close');
InitGrid();
}
else {
$.messager.alert('Warning', '失败!');
}
}
})
}
}
function OpenWin() {
$('#Hidden_editflag').val(1);
$("#edit").dialog("open"); //打开编辑dialog
}
//打开编辑窗口
function editdialog() {
$('#Hidden_editflag').val(2);
var rows = $('#datagrid_collector').datagrid('getSelections');
if (rows.length == 1)//如果选择为1一个才合法不可以编辑2个。
{
$("#edit").dialog("open");
$('#UserName').val(rows[0].JSON_用户姓名);
$('#UserNum').val(rows[0].JSON_用户名);
$('#password').val(rows[0].JSON_密码);
$('#workernum').val(rows[0].JSON_员工编号);
$('#groupnum').val(rows[0].JSON_班组);
$('#position').val(rows[0].JSON_工作岗位);
$('#phoneNum').val(rows[0].JSON_联系电话);
var num = rows[0].JSON_角色编号;
$('#role').combobox('setValue', num);
}
else if (rows.length >= 2) {
$.messager.alert('提示', '不能多选', 'warning');
}
else {
$.messager.alert('提示', '请选择您要修改的项目', 'warning');
}
}
//删除
function deleteCollector() {
var rows = $('#datagrid_collector').datagrid('getSelections'); //首先获得你所选择的行。
if (rows.length > 0) {//最少选择一行
$.messager.confirm('请确认', '您确定要删除你所选择的项目吗?', function (b) {
if (b) {//这里面b为如果你在前台选择“是”的话就为true
var ids = [];
for (var i = 0; i < rows.length; i++) {
ids.push(rows[i].JSON_用户编号); //这个地方跟你id值的 field内的内容一样。 将这一行的id值给ids数组了。后台接收的到是[1,2,3]这样一个数组,后台得写一个分割函数。
}
$.ajax({
url: '../submit/UserManage.ashx?type=CollectorDelete',
data: {
ids: ids.join(',')//这个方法给你返回去的是一个字符串。最后你写删除的存储过程语句的时候可以where可以用in12这种方法实现
},
dataType: 'json',
success: function (data) {
$('#datagrid_collector').datagrid('load'); //删除完刷新一下页面。因为这里不需要提交参数,所以得需要
$('#datagrid_collector').datagrid('unselectAll'); //取消选中,每次执行完操作,都应该注意:每次弄完都应该注意这个。
data = eval("(" + data + ")"); //注意要转化为对象
if (data.result == "1") {
$.messager.alert('提示信息', '删除成功');
}
else {
$.messager.alert('Warning', '删除失败!');
}
}
})
}
});
}
else {
$.messager.alert('提示', '请选择要删除的项目', 'warning'); //不能一条都不选
}
}
//取消操作
function removeEidt() {
$('#datagrid_collector').datagrid('unselectAll');
}
//清空
function clearCollectorForm() {
$('#form_edit').find('input').val('');
}
//初始化角色
function Init_role() {
$('#role').combobox({
url: '../submit/UserManage.ashx?type=Selectrole',
valueField: '角色编号',
textField: '角色名称',
mode: 'remote', //这个地方别忘了,这个地方决定你是否可以加载本地数据
required: true,
panelHeight: 80
});
}
//增加图片
function pic_add() {
var rows = $('#datagrid_collector').datagrid('getSelections'); //首先获得你所选择的行。
if (rows.length == 1) {//只可以选择一行
var userNum = rows[0].JSON_用户编号;
$.ajax({
type: "POST",
url: '../submit/UserManage.ashx?type=pic_add&filename=' + filename + "&UserNum=" + userNum,
success: function (r) {
r = eval("(" + r + ")"); //注意要转化为对象
if (r.result == "1") {
$.messager.alert('提示信息', '数据处理成功');
}
else {
$.messager.alert('提示信息', '失败');
}
}
})
}
else {
$.messager.alert('提示', '请选择要上传照片的员工', 'warning'); //不能一条都不选
}
}
//更新数据库后显示数据库中的图片
function showpic(userNum) {
$.ajax({
type: "POST",
url: '../submit/UserManage.ashx?type=showpic&filename=' + filename + "&UserNum=" + userNum,
success: function (r) {
if (r != "") {
filename = r;
$("#picturebox_img").attr("src", "UploadFile/" + filename);
}
else {
$("#picturebox_img").attr("src", "../images/noPhoto.jpg");
}
}
})
}
</script>
<title></title>
</head>
<body style="margin: 2px;" class="easyui-layout">
<div style="position: relative;">
<div class="full_dark" id="full_dark" style="display: none">
</div>
<div style="position: relative;">
<div class="imgLoad" style="display: none">
<div id="fileQueue">
</div>
<input type="file" name="uploadify" id="uploadify" />
<p>
<a href="javascript:$('#uploadify').uploadifyUpload()" class="btn1">上传</a><span class="null1">
</span><a href="#" onclick="colseWindow()" class="btn2">取消</a>
</p>
</div>
</div>
</div>
<div region="north" style="height: 300px;">
<table id="datagrid_collector" border="false">
</table>
</div>
<div region="center" id="div_tab_assembly_img" style="background: #eee;"
align="center">
<table>
<tr>
<td height="5px">
</td></tr>
<tr>
<td align="center" colspan="2">
<div style="border: 1px solid #000000; height: 200px; width:150px;">
<img id="picturebox_img" src="../images/noPhoto.jpg" style="height: 100%;
width: 100%" />
</div>
</td></tr>
<tr>
<td align="right">
<a id="A1" href="#" plain="true" class="easyui-linkbutton" icon="icon-edit" title="修改"
onclick="openWindow()">上传</a>
</td>
<td align="left">
<a id="add" href="#" plain="true" class="easyui-linkbutton" icon="icon-add" title="增加"
onclick="pic_add()">确定</a>
</td>
</tr></table>
</div>
<div id="tab_toolbar">
<table>
<tr>
<td>
<a id="a_add" href="#" plain="true" class="easyui-linkbutton" icon="icon-add" title="添加"
onclick="OpenWin()">添加</a>
</td>
<td>
<a id="a_edit" href="#" plain="true" class="easyui-linkbutton" icon="icon-edit" title="编辑"
onclick="editdialog()">编辑</a>
</td>
<td>
<a id="a_delete" href="#" plain="true" class="easyui-linkbutton" icon="icon-cancel"
title="删除" onclick="deleteCollector()">删除</a>
</td>
<td>
<a id="a_removeEdit" href="#" plain="true" class="easyui-linkbutton" icon="icon-undo"
onclick="removeEidt()">取消</a>
</td>
</tr>
</table>
</div>
<div id="edit" class="easyui-dialog" title="添加用户" style="width: 350px; height: 300px;"
modal="true" closed="true">
<form id="form_edit" name="form_edit" method="post">
<table class="table_edit">
<tr>
<td>
用户姓名:
</td>
<td>
<input id="UserName" name="UserName" type="text" class="easyui-validatebox" required="true" />
</td>
</tr>
<tr>
<td>
用户名:
</td>
<td>
<input id="UserNum" name="UserNum" type="text" class="easyui-validatebox" required="true" />
</td>
</tr>
<tr>
<td>
密码:
</td>
<td>
<input id="password" name="password" type="text" class="easyui-validatebox" required="true" />
</td>
</tr>
<tr>
<td>
角色:
</td>
<td>
<input id="role" name="role" type="text" class="easyui-validatebox" required="true" />
</td>
</tr>
<tr>
<td>
员工编号:
</td>
<td>
<input id="workernum" name="workernum" type="text" class="easyui-validatebox" required="true" />
</td>
</tr>
<tr>
<td>
班组:
</td>
<td>
<input id="groupnum" name="groupnum" type="text" class="easyui-validatebox" required="true" />
</td>
</tr>
<tr>
<td>
工作岗位:
</td>
<td>
<input id="position" name="position" type="text" class="easyui-validatebox" required="true" />
</td>
</tr>
<tr>
<td>
联系电话:
</td>
<td>
<input id="phoneNum" name="phoneNum" type="text" class="easyui-validatebox" required="true" />
</td>
</tr>
<tr>
<td>
<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-save" onclick="submitCollectorForm()">
提交</a>
</td>
<td>
<a href="javascript:void(0);" class="easyui-linkbutton" iconcls="icon-redo" onclick="clearCollectorForm()">
清空</a>
</td>
</tr>
</table>
</form>
</div>
<div>
<input id="Hidden_editflag" name="Hidden_editflag" type="hidden" />
</div>
</body>
</html>

95
webpage/dist/SQLDemo.html vendored Normal file
View File

@@ -0,0 +1,95 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<script src="../JS/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
//var URL = "";
//var SQLJson1 = {
// Type: "PROCEDURE",
// Name: "",
// Params: [
// { "当前工作日期": "2012-1-1" },
// ],
// HasReturn: true,
//}
//var SQLJson2 = {
// Type: "PROCEDURE",
// Name: "",
// Params: [
// { "当前工作日期": "2012-1-1" },
// ],
// HasReturn: true,
//}
function btnTest() {
var SQLJson2 = {
"Type": $("#TYPE").val(),
"Name": $("#NAME").val(),
"Param": $("#PARAM1value").val(),
"Pagination": $("#Pagination").val(),
"UserID": $("#NAME").val(),
HasReturn: $("#HASRETURN").get(0).checked
}
$.ajax({
url: $("#URL").val(),
type: 'POST',
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: JSON.stringify(SQLJson2),
success: function (data) {
$("#testResult").text(JSON.stringify(data));
},
error: function (data) {
}
});
}
</script>
<style>
.td{
width:400px;
}
input{
width:100%;
}
</style>
</head>
<body>
<table style="width:600px;">
<tr>
<td>URL:</td>
<td class=".td"><input id="URL" type="text" value="../submit/MESCommonBase.ashx" /></td>
</tr>
<tr>
<td>TYPE:</td>
<td class=".td"><input id="TYPE" type="text" />(1 表示 执行存储过程 2 表示执行sql语句)</td>
</tr>
<tr>
<td>NAME:</td>
<td class=".td"><input id="NAME" type="text" />存储过程或者sql语句的名称</td>
</tr>
<tr>
<td>PARAM: </td>
<td class=".td"><input id="PARAM1value" type="text" />存储过程或者sql的语句的参数</td>
</tr>
<tr>
<td>Pagination: </td>
<td class=".td"><input id="Pagination" type="text" />(分页的参数)</td>
</tr>
<tr>
<td>返回值: <input style="display:inline" id="HASRETURN" type="checkbox" checked="checked" /></td>
<td></td>
</tr>
<tr>
<td><input type="button" onclick="btnTest()" value="testBtn" /></td>
</tr>
<tr style="height:400px;">
<td style="height:100%;" colspan="2">返回数据:<textarea id="testResult" style="width:100%;height:90%;" rows="30" cols="20"></textarea></td>
</tr>
</table>
</body>
</html>

1533
webpage/dist/axios.js vendored Normal file

File diff suppressed because it is too large Load Diff

1
webpage/dist/axios.map vendored Normal file

File diff suppressed because one or more lines are too long

9
webpage/dist/axios.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
webpage/dist/axios.min.map vendored Normal file

File diff suppressed because one or more lines are too long

11965
webpage/dist/vue.js vendored Normal file

File diff suppressed because it is too large Load Diff