From e9445940a8db28fef9f1b28dfb817c9c6f4e0848 Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期二, 18 一月 2022 13:17:03 +0800
Subject: [PATCH] 新增标准工时报表

---
 WebAPI/Web.config                                |   50 ++++++------
 WebAPI/packages.config                           |    6 +
 WebAPI/Controllers/Sc_PackUnionBillController.cs |  129 ++++++++++++++++++++++++++++++++
 WebAPI/WebAPI.csproj                             |   29 ++++++-
 4 files changed, 184 insertions(+), 30 deletions(-)

diff --git a/WebAPI/Controllers/Sc_PackUnionBillController.cs b/WebAPI/Controllers/Sc_PackUnionBillController.cs
new file mode 100644
index 0000000..bbec325
--- /dev/null
+++ b/WebAPI/Controllers/Sc_PackUnionBillController.cs
@@ -0,0 +1,129 @@
+锘縰sing 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
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Web.config b/WebAPI/Web.config
index d25ba42..8d72221 100644
--- a/WebAPI/Web.config
+++ b/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>
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 6011867..a9b263c 100644
--- a/WebAPI/WebAPI.csproj
+++ b/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" />
diff --git a/WebAPI/packages.config b/WebAPI/packages.config
index 3de9d27..a221f06 100644
--- a/WebAPI/packages.config
+++ b/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" />

--
Gitblit v1.9.1