WebAPI/Controllers/Sc_PackUnionBillController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Web.config | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/WebAPI.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/packages.config | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
WebAPI/Controllers/Sc_PackUnionBillController.cs
New file @@ -0,0 +1,129 @@ using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using WebAPI.Models; namespace WebAPI.Controllers { public class Sc_PackUnionBillController : ApiController { public DBUtility.ClsPub.Enum_BillStatus BillStatus;//单据状态(新增,修改,浏览,更新单价,变更) private json objJsonResult = new json(); public DataSet ds = new DataSet(); public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); #region 标准工时单列表 [Route("Sc_PackUnionBill/GetSc_StationInBillList")] [HttpGet] public object GetSc_StationInBillList(string sWhere) { try { ds = oCn.RunProcReturn("select * from h_v_Sc_StationInBillListMain order by hmainid desc", "h_v_Sc_StationInBillListMain"); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "返回记录成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 标准工时导出Excel表格数据 [Route("Sc_PackUnionBill/Sc_StationInBillSetExcel")] [HttpGet] public object Sc_StationInBillSetExcel() { try { ds = oCn.RunProcReturn("select * from h_v_Sc_StationInBillListMain order by hmainid desc", "h_v_Sc_StationInBillListMain"); IWorkbook book = new HSSFWorkbook(); ISheet sheet = book.CreateSheet("sheet1"); IRow row1 = sheet.CreateRow(0); row1.CreateCell(0).SetCellValue("进站生产订单号"); row1.CreateCell(1).SetCellValue("流转卡号"); row1.CreateCell(2).SetCellValue("进出站所用时间"); row1.CreateCell(3).SetCellValue("工时"); row1.CreateCell(4).SetCellValue("不良数量"); row1.CreateCell(5).SetCellValue("报废数量"); row1.CreateCell(6).SetCellValue("进站数量"); row1.CreateCell(7).SetCellValue("出站数量"); row1.CreateCell(8).SetCellValue("出站时间"); row1.CreateCell(9).SetCellValue("进站时间"); row1.CreateCell(10).SetCellValue("制单人"); row1.CreateCell(11).SetCellValue("制单日期"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { IRow row = sheet.CreateRow(i + 1); row.CreateCell(0).SetCellValue(ds.Tables[0].Rows[i]["进站生产订单号"].ToString()); row.CreateCell(1).SetCellValue(ds.Tables[0].Rows[i]["流转卡号"].ToString()); row.CreateCell(2).SetCellValue(ds.Tables[0].Rows[i]["进出站所用时间"].ToString()); row.CreateCell(3).SetCellValue(ds.Tables[0].Rows[i]["工时"].ToString()); row.CreateCell(4).SetCellValue(ds.Tables[0].Rows[i]["不良数量"].ToString()); row.CreateCell(5).SetCellValue(ds.Tables[0].Rows[i]["报废数量"].ToString()); row.CreateCell(6).SetCellValue(ds.Tables[0].Rows[i]["进站数量"].ToString()); row.CreateCell(7).SetCellValue(ds.Tables[0].Rows[i]["出站数量"].ToString()); row.CreateCell(8).SetCellValue(ds.Tables[0].Rows[i]["出站时间"].ToString()); row.CreateCell(9).SetCellValue(ds.Tables[0].Rows[i]["进站时间"].ToString()); row.CreateCell(10).SetCellValue(ds.Tables[0].Rows[i]["制单人"].ToString()); row.CreateCell(11).SetCellValue(ds.Tables[0].Rows[i]["制单日期"].ToString()); } string filename = "C:/Users/Administrator/Desktop/标准工时表" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-ffff") + ".xls"; MemoryStream BookStream = new MemoryStream(); book.Write(BookStream); BookStream.Seek(0, SeekOrigin.Begin); byte[] buffer = BookStream.ToArray(); using (FileStream fs = new FileStream(filename, FileMode.CreateNew, FileAccess.Write)) { try { fs.Write(buffer, 0, buffer.Length); fs.Flush(); } catch { } finally { fs.Dispose(); BookStream.Dispose(); } } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "成功导出表格至桌面"; objJsonResult.data = null; return objJsonResult; } catch (Exception ex) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "导出失败" + ex.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion } } WebAPI/Web.config
@@ -1,19 +1,19 @@ <?xml version="1.0"?> <?xml version="1.0" encoding="utf-8"?> <!-- 有关如何配置 ASP.NET 应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=301879 --> <configuration> <configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <section name="WebAPI.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> </configSections> <appSettings> <add key="webpages:Version" value="3.0.0.0"/> <add key="webpages:Enabled" value="false"/> <add key="ClientValidationEnabled" value="true"/> <add key="UnobtrusiveJavaScriptEnabled" value="true"/> <add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Enabled" value="false" /> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> </appSettings> <!-- 有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。 @@ -24,9 +24,9 @@ </system.Web> --> <system.web> <compilation debug="true" targetFramework="4.5"/> <httpRuntime/> <pages controlRenderingCompatibilityVersion="4.0"/> <compilation debug="true" targetFramework="4.5" /> <httpRuntime /> <pages controlRenderingCompatibilityVersion="4.0" /> </system.web> <system.webServer> <httpProtocol> @@ -38,45 +38,45 @@ </customHeaders> </httpProtocol> <handlers> <remove name="ExtensionlessUrlHandler-Integrated-4.0"/> <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <!--<remove name="OPTIONSVerbHandler"/>--> <remove name="TRACEVerbHandler"/> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/> <remove name="TRACEVerbHandler" /> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers> </system.webServer> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/> <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" /> <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" /> </dependentAssembly> <!--<dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/> </dependentAssembly>--> <dependentAssembly> <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/> <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> </assemblyBinding> </runtime> WebAPI/WebAPI.csproj
@@ -44,6 +44,9 @@ <Prefer32Bit>false</Prefer32Bit> </PropertyGroup> <ItemGroup> <Reference Include="Alex.Kingdee.Cloud.WebAPI.Client, Version=2.5.0.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\packages\Alex.Kingdee.Cloud.WebAPI.Client.2.5.0\lib\net45\Alex.Kingdee.Cloud.WebAPI.Client.dll</HintPath> </Reference> <Reference Include="Antlr3.Runtime, Version=3.4.1.9004, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL"> <HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath> <Private>True</Private> @@ -51,6 +54,9 @@ <Reference Include="BLL, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>DLL\BLL.dll</HintPath> </Reference> <Reference Include="BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL"> <HintPath>..\packages\Portable.BouncyCastle.1.8.9\lib\net40\BouncyCastle.Crypto.dll</HintPath> </Reference> <Reference Include="DAL, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> @@ -60,9 +66,12 @@ <SpecificVersion>False</SpecificVersion> <HintPath>DLL\DBUtility.dll</HintPath> </Reference> <Reference Include="ICSharpCode.SharpZipLib, Version=1.3.2.10, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL"> <HintPath>..\packages\SharpZipLib.1.3.2\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath> </Reference> <Reference Include="Kingdee.BOS.WebApi.Client, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\欧讯WMS条码系统20201016\CLOUDWEB1\DLL\Kingdee.BOS.WebApi.Client.dll</HintPath> <HintPath>..\..\..\WebService\MESWMS-WEBS\CLOUDWEB\bin\Kingdee.BOS.WebApi.Client.dll</HintPath> </Reference> <Reference Include="Kingdee.BOS.WebApi.FormService, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> @@ -88,9 +97,20 @@ <SpecificVersion>False</SpecificVersion> <HintPath>DLL\Model.dll</HintPath> </Reference> <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>DLL\Newtonsoft.Json.dll</HintPath> <Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> <Reference Include="NPOI, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"> <HintPath>..\packages\NPOI.2.5.5\lib\net45\NPOI.dll</HintPath> </Reference> <Reference Include="NPOI.OOXML, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"> <HintPath>..\packages\NPOI.2.5.5\lib\net45\NPOI.OOXML.dll</HintPath> </Reference> <Reference Include="NPOI.OpenXml4Net, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"> <HintPath>..\packages\NPOI.2.5.5\lib\net45\NPOI.OpenXml4Net.dll</HintPath> </Reference> <Reference Include="NPOI.OpenXmlFormats, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"> <HintPath>..\packages\NPOI.2.5.5\lib\net45\NPOI.OpenXmlFormats.dll</HintPath> </Reference> <Reference Include="Pub_Class, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> @@ -327,6 +347,7 @@ <Compile Include="Controllers\ProductionReportController.cs" /> <Compile Include="Controllers\ProductInController.cs" /> <Compile Include="Controllers\Sc_AssemblyBillController.cs" /> <Compile Include="Controllers\Sc_PackUnionBillController.cs" /> <Compile Include="Controllers\SellOutBackController.cs" /> <Compile Include="Controllers\SellOutController.cs" /> <Compile Include="ListModels.cs" /> WebAPI/packages.config
@@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="Alex.Kingdee.Cloud.WebAPI.Client" version="2.5.0" targetFramework="net45" /> <package id="Antlr" version="3.4.1.9004" targetFramework="net45" /> <package id="bootstrap" version="3.0.0" targetFramework="net45" /> <package id="jQuery" version="1.10.2" targetFramework="net45" /> @@ -19,7 +20,10 @@ <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net45" /> <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" /> <package id="Modernizr" version="2.6.2" targetFramework="net45" /> <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" /> <package id="Newtonsoft.Json" version="11.0.1" targetFramework="net45" /> <package id="NPOI" version="2.5.5" targetFramework="net45" /> <package id="Portable.BouncyCastle" version="1.8.9" targetFramework="net45" /> <package id="SharpZipLib" version="1.3.2" targetFramework="net45" /> <package id="Swashbuckle" version="5.0.0" targetFramework="net45" /> <package id="Swashbuckle.Core" version="5.0.0" targetFramework="net45" /> <package id="System.IdentityModel.Tokens.Jwt" version="4.0.0" targetFramework="net45" />