Bläddra i källkod

qc增加大量数据导出功能

qinqi 2 månader sedan
förälder
incheckning
4176d3947e

+ 130 - 0
DK.Client/ReportModule/R08/ExportForm.cs

@@ -0,0 +1,130 @@
+using Dongke.IBOSS.PRD.Basics.BaseControls;
+using System;
+using System.Drawing;
+using System.IO;
+using System.Windows.Forms;
+
+public class MinimalExportForm : FormBase
+{
+    private string _filePath;
+
+    public MinimalExportForm(string filePath)
+    {
+        _filePath = filePath;
+        InitializeForm();
+    }
+
+    private void InitializeForm()
+    {
+        this.Text = "导出完成";
+        this.Size = new Size(400, 250);
+        this.StartPosition = FormStartPosition.CenterScreen;
+
+        Panel panel = new Panel
+        {
+            Dock = DockStyle.Fill,
+            Padding = new Padding(20)
+        };
+
+        // 成功图标
+        Label lblSuccess = new Label
+        {
+            Text = "✓",
+            Font = new Font("Arial", 24, FontStyle.Bold),
+            ForeColor = Color.Green,
+            Location = new Point(20, 20),
+            AutoSize = true
+        };
+
+        // 成功消息
+        Label lblMessage = new Label
+        {
+            Text = "数据导出成功!",
+            Font = new Font("微软雅黑", 11, FontStyle.Bold),
+            Location = new Point(60, 25),
+            AutoSize = true
+        };
+
+        // 文件路径(简化显示)
+        string displayPath = _filePath;
+        if (_filePath.Length > 40)
+        {
+            displayPath = "..." + _filePath.Substring(_filePath.Length - 40);
+        }
+
+        Label lblPath = new Label
+        {
+            Text = displayPath,
+            Location = new Point(20, 70),
+            Size = new Size(350, 20),
+            ForeColor = Color.DarkBlue
+        };
+
+        // 操作按钮
+        Button btnOpen = new Button
+        {
+            Text = "打开文件",
+            Size = new Size(80, 30),
+            Location = new Point(80, 100)
+        };
+        btnOpen.Click += (s, e) => OpenFile();
+
+        Button btnFolder = new Button
+        {
+            Text = "打开文件夹",
+            Size = new Size(80, 30),
+            Location = new Point(170, 100)
+        };
+        btnFolder.Click += (s, e) => OpenFolder();
+
+        Button btnClose = new Button
+        {
+            Text = "关闭",
+            Size = new Size(80, 30),
+            Location = new Point(260, 100)
+        };
+        btnClose.Click += (s, e) => this.Close();
+
+        panel.Controls.Add(lblSuccess);
+        panel.Controls.Add(lblMessage);
+        panel.Controls.Add(lblPath);
+        panel.Controls.Add(btnOpen);
+        panel.Controls.Add(btnFolder);
+        panel.Controls.Add(btnClose);
+
+        this.Controls.Add(panel);
+    }
+
+    private void OpenFile()
+    {
+        if (File.Exists(_filePath))
+        {
+            System.Diagnostics.Process.Start(_filePath);
+        }
+    }
+
+    private void OpenFolder()
+    {
+        if (File.Exists(_filePath))
+        {
+            string argument = $"/select, \"{_filePath}\"";
+            System.Diagnostics.Process.Start("explorer.exe", argument);
+        }
+    }
+
+	private void InitializeComponent()
+	{
+			this.SuspendLayout();
+			// 
+			// MinimalExportForm
+			// 
+			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+			this.ClientSize = new System.Drawing.Size(284, 263);
+			this.Name = "MinimalExportForm";
+			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+			this.Text = "导出";
+			this.ResumeLayout(false);
+			this.PerformLayout();
+
+	}
+}

+ 120 - 0
DK.Client/ReportModule/R08/ExportForm.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 584 - 571
DK.Client/ReportModule/R08/F_RPT_080114.Designer.cs


+ 28 - 3
DK.Client/ReportModule/R08/F_RPT_080114.cs

@@ -12,6 +12,7 @@ using System;
 using System.Collections.Generic;
 using System.Data;
 using System.Linq;
+using System.Reflection;
 using System.Windows.Forms; 
 using Dongke.IBOSS.PRD.Basics.BaseResources; 
 using Dongke.IBOSS.PRD.Client.CommonModule;
@@ -471,9 +472,33 @@ namespace Dongke.IBOSS.PRD.Client.ReportModule
                 return;
             }
             handle(radioButton1.Checked, radioButton3.Checked);
-        } 
-        #endregion
-    }
+        }
+		#endregion
+
+        /// <summary>
+        /// 导出明细
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+		private void tsbtnExport_Click(object sender, EventArgs e)
+		{
+            try
+            {
+				SAPDataModule.F_RPT_08011401 f = new SAPDataModule.F_RPT_08011401();
+                DialogResult dialogResult = f.ShowDialog();
+
+                if (dialogResult == DialogResult.OK)
+                { 
+                }
+            }
+            catch (Exception ex)
+            {
+                // 对异常进行共通处理
+                ExceptionManager.HandleEventException(this.ToString(),
+                    MethodBase.GetCurrentMethod().Name, this.Text, ex);
+            }
+        }
+	}
    
 
     #endregion

+ 211 - 0
DK.Client/ReportModule/R08/F_RPT_08011401.Designer.cs

@@ -0,0 +1,211 @@
+namespace Dongke.IBOSS.PRD.Client.SAPDataModule
+{
+    partial class F_RPT_08011401
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(F_RPT_08011401));
+			this.lblSyncDate = new Dongke.WinForm.Controls.LblLabel();
+			this.btnSave = new Dongke.IBOSS.PRD.Basics.BaseControls.C_Button();
+			this.dtpCreateTimeBegin = new Dongke.IBOSS.PRD.Basics.BaseControls.C_DateTimePicker();
+			this.dtpCreateTimeEnd = new Dongke.IBOSS.PRD.Basics.BaseControls.C_DateTimePicker();
+			this.lblLabel1 = new Dongke.WinForm.Controls.LblLabel();
+			this.lblCheckType = new Dongke.IBOSS.PRD.Basics.BaseControls.C_Label();
+			this.cmbCheckType = new Dongke.IBOSS.PRD.Basics.BaseControls.C_ComboBox();
+			this.c_Label1 = new Dongke.IBOSS.PRD.Basics.BaseControls.C_Label();
+			this.txtFilePath = new Dongke.IBOSS.PRD.Basics.BaseControls.C_TextBox();
+			this.tsbtnchooesfile = new Dongke.IBOSS.PRD.Basics.BaseControls.C_Button();
+			this.SuspendLayout();
+			// 
+			// lblSyncDate
+			// 
+			this.lblSyncDate.Location = new System.Drawing.Point(12, 16);
+			this.lblSyncDate.Name = "lblSyncDate";
+			this.lblSyncDate.Size = new System.Drawing.Size(53, 12);
+			this.lblSyncDate.TabIndex = 0;
+			this.lblSyncDate.Text = "开始日期";
+			// 
+			// btnSave
+			// 
+			this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+			this.btnSave.BackColor = System.Drawing.Color.Transparent;
+			this.btnSave.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnSave.BackgroundImage")));
+			this.btnSave.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+			this.btnSave.ForeColor = System.Drawing.Color.White;
+			this.btnSave.Location = new System.Drawing.Point(313, 114);
+			this.btnSave.Name = "btnSave";
+			this.btnSave.Size = new System.Drawing.Size(85, 30);
+			this.btnSave.TabIndex = 4;
+			this.btnSave.Text = "导出(&S)";
+			this.btnSave.UseVisualStyleBackColor = false;
+			this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
+			// 
+			// dtpCreateTimeBegin
+			// 
+			this.dtpCreateTimeBegin.CustomFormat = "yyyy-MM-dd";
+			this.dtpCreateTimeBegin.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+			this.dtpCreateTimeBegin.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+			this.dtpCreateTimeBegin.Location = new System.Drawing.Point(71, 12);
+			this.dtpCreateTimeBegin.Name = "dtpCreateTimeBegin";
+			this.dtpCreateTimeBegin.Size = new System.Drawing.Size(130, 21);
+			this.dtpCreateTimeBegin.TabIndex = 34;
+			// 
+			// dtpCreateTimeEnd
+			// 
+			this.dtpCreateTimeEnd.CustomFormat = "yyyy-MM-dd";
+			this.dtpCreateTimeEnd.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+			this.dtpCreateTimeEnd.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
+			this.dtpCreateTimeEnd.Location = new System.Drawing.Point(266, 12);
+			this.dtpCreateTimeEnd.Name = "dtpCreateTimeEnd";
+			this.dtpCreateTimeEnd.Size = new System.Drawing.Size(129, 21);
+			this.dtpCreateTimeEnd.TabIndex = 36;
+			// 
+			// lblLabel1
+			// 
+			this.lblLabel1.Location = new System.Drawing.Point(207, 16);
+			this.lblLabel1.Name = "lblLabel1";
+			this.lblLabel1.Size = new System.Drawing.Size(53, 12);
+			this.lblLabel1.TabIndex = 37;
+			this.lblLabel1.Text = "结束日期";
+			// 
+			// lblCheckType
+			// 
+			this.lblCheckType.AutoSize = true;
+			this.lblCheckType.BackColor = System.Drawing.Color.Transparent;
+			this.lblCheckType.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+			this.lblCheckType.ForeColor = System.Drawing.SystemColors.ControlText;
+			this.lblCheckType.Location = new System.Drawing.Point(12, 51);
+			this.lblCheckType.Name = "lblCheckType";
+			this.lblCheckType.Size = new System.Drawing.Size(53, 12);
+			this.lblCheckType.TabIndex = 39;
+			this.lblCheckType.Text = "检验类型";
+			// 
+			// cmbCheckType
+			// 
+			this.cmbCheckType.BackColor = System.Drawing.SystemColors.Window;
+			this.cmbCheckType.BackgroundColor = System.Drawing.SystemColors.Window;
+			this.cmbCheckType.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+			this.cmbCheckType.FormattingEnabled = true;
+			this.cmbCheckType.Location = new System.Drawing.Point(71, 48);
+			this.cmbCheckType.Name = "cmbCheckType";
+			this.cmbCheckType.Size = new System.Drawing.Size(130, 20);
+			this.cmbCheckType.TabIndex = 38;
+			// 
+			// c_Label1
+			// 
+			this.c_Label1.AutoSize = true;
+			this.c_Label1.BackColor = System.Drawing.Color.Transparent;
+			this.c_Label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+			this.c_Label1.ForeColor = System.Drawing.SystemColors.ControlText;
+			this.c_Label1.Location = new System.Drawing.Point(12, 84);
+			this.c_Label1.Name = "c_Label1";
+			this.c_Label1.Size = new System.Drawing.Size(53, 12);
+			this.c_Label1.TabIndex = 40;
+			this.c_Label1.Text = "导出路径";
+			// 
+			// txtFilePath
+			// 
+			this.txtFilePath.BackColor = System.Drawing.SystemColors.Window;
+			this.txtFilePath.BackgroundColor = System.Drawing.SystemColors.Window;
+			this.txtFilePath.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
+			this.txtFilePath.ErrorMessage = "";
+			this.txtFilePath.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+			this.txtFilePath.ImeMode = System.Windows.Forms.ImeMode.Off;
+			this.txtFilePath.Location = new System.Drawing.Point(71, 81);
+			this.txtFilePath.MaxLength = 50;
+			this.txtFilePath.Name = "txtFilePath";
+			this.txtFilePath.Size = new System.Drawing.Size(324, 21);
+			this.txtFilePath.TabIndex = 41;
+			this.txtFilePath.TextValue = "";
+			// 
+			// tsbtnchooesfile
+			// 
+			this.tsbtnchooesfile.BackColor = System.Drawing.Color.Transparent;
+			this.tsbtnchooesfile.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("tsbtnchooesfile.BackgroundImage")));
+			this.tsbtnchooesfile.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+			this.tsbtnchooesfile.ForeColor = System.Drawing.Color.White;
+			this.tsbtnchooesfile.Location = new System.Drawing.Point(71, 108);
+			this.tsbtnchooesfile.Name = "tsbtnchooesfile";
+			this.tsbtnchooesfile.Size = new System.Drawing.Size(71, 26);
+			this.tsbtnchooesfile.TabIndex = 42;
+			this.tsbtnchooesfile.Text = "选择";
+			this.tsbtnchooesfile.UseVisualStyleBackColor = false;
+			this.tsbtnchooesfile.Click += new System.EventHandler(this.tsbtnchooesfile_Click);
+			// 
+			// F_RPT_08011401
+			// 
+			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+			this.ClientSize = new System.Drawing.Size(410, 169);
+			this.Controls.Add(this.tsbtnchooesfile);
+			this.Controls.Add(this.txtFilePath);
+			this.Controls.Add(this.c_Label1);
+			this.Controls.Add(this.lblCheckType);
+			this.Controls.Add(this.cmbCheckType);
+			this.Controls.Add(this.lblLabel1);
+			this.Controls.Add(this.dtpCreateTimeEnd);
+			this.Controls.Add(this.dtpCreateTimeBegin);
+			this.Controls.Add(this.btnSave);
+			this.Controls.Add(this.lblSyncDate);
+			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+			this.IsSaveFormSize = false;
+			this.MaximizeBox = false;
+			this.MinimizeBox = false;
+			this.Name = "F_RPT_08011401";
+			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+			this.StatusSizingGrip = false;
+			this.Text = "导出明细";
+			this.Load += new System.EventHandler(this.F_RPT_08011401_Load_1);
+			this.Controls.SetChildIndex(this.lblSyncDate, 0);
+			this.Controls.SetChildIndex(this.btnSave, 0);
+			this.Controls.SetChildIndex(this.dtpCreateTimeBegin, 0);
+			this.Controls.SetChildIndex(this.dtpCreateTimeEnd, 0);
+			this.Controls.SetChildIndex(this.lblLabel1, 0);
+			this.Controls.SetChildIndex(this.cmbCheckType, 0);
+			this.Controls.SetChildIndex(this.lblCheckType, 0);
+			this.Controls.SetChildIndex(this.c_Label1, 0);
+			this.Controls.SetChildIndex(this.txtFilePath, 0);
+			this.Controls.SetChildIndex(this.tsbtnchooesfile, 0);
+			this.ResumeLayout(false);
+			this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private WinForm.Controls.LblLabel lblSyncDate;
+        private Basics.BaseControls.C_Button btnSave;
+		private Basics.BaseControls.C_DateTimePicker dtpCreateTimeBegin;
+		private Basics.BaseControls.C_DateTimePicker dtpCreateTimeEnd;
+		private WinForm.Controls.LblLabel lblLabel1;
+		private Basics.BaseControls.C_Label lblCheckType;
+		private Basics.BaseControls.C_ComboBox cmbCheckType;
+		private Basics.BaseControls.C_Label c_Label1;
+		private Basics.BaseControls.C_TextBox txtFilePath;
+		private Basics.BaseControls.C_Button tsbtnchooesfile;
+	}
+}

+ 170 - 0
DK.Client/ReportModule/R08/F_RPT_08011401.cs

@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
+ * 类的信息:
+ *      1.程序名称:F_RPT_08011401.cs
+ *      2.功能描述:导出
+ * 编辑履历:
+ *      作者            日期                版本            修改内容
+ *      陈晓野          2018/11/16          1.00            新建
+ *******************************************************************************/
+using System;
+using System.Data;
+using System.IO;
+using System.Reflection;
+using System.Windows.Forms;
+using Dongke.IBOSS.PRD.Basics.BaseControls;
+using Dongke.IBOSS.PRD.Client.CommonModule;
+using Dongke.IBOSS.PRD.WCF.DataModels;
+using Dongke.IBOSS.PRD.WCF.Proxys;
+
+namespace Dongke.IBOSS.PRD.Client.SAPDataModule
+{
+    public partial class F_RPT_08011401 : FormBase
+    {
+        public F_RPT_08011401()
+        {
+            InitializeComponent();
+            this.dtpCreateTimeBegin.Value = DateTime.Now.Date.AddDays(-1);
+            this.dtpCreateTimeEnd.Value = DateTime.Now.Date;
+            
+        }
+        /// <summary>
+        /// 画面加载
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param> 
+        private void F_RPT_08011401_Load_1(object sender, EventArgs e)
+        {
+            try
+            { 
+                DataTable dtCheckType = new DataTable();
+                dtCheckType.Columns.Add("Flag", typeof(string));
+                dtCheckType.Columns.Add("FlagName", typeof(string));
+
+                DataRow newRow = dtCheckType.NewRow();
+                dtCheckType.Rows.Add(newRow);
+                newRow = dtCheckType.NewRow();
+                newRow["Flag"] = "1";
+                newRow["FlagName"] = "型式检验";
+                dtCheckType.Rows.Add(newRow);
+                newRow = dtCheckType.NewRow();
+                newRow["Flag"] = "2";
+                newRow["FlagName"] = "非型式检验";
+                dtCheckType.Rows.Add(newRow);
+                newRow = dtCheckType.NewRow();
+                newRow["Flag"] = "3";
+                newRow["FlagName"] = "首件检验";
+                dtCheckType.Rows.Add(newRow);
+
+                this.cmbCheckType.DisplayMember = "FlagName";
+                this.cmbCheckType.ValueMember = "Flag";
+                this.cmbCheckType.DataSource = dtCheckType;
+            }
+            catch (Exception ex)
+            {
+                // 对异常进行共通处理
+                ExceptionManager.HandleEventException(ToString(),
+                    MethodBase.GetCurrentMethod().Name, Text, ex);
+            }
+        }
+        /// <summary>
+        /// 同步
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void btnSave_Click(object sender, EventArgs e)
+        {
+            try
+            {
+				if (string.IsNullOrWhiteSpace(this.cmbCheckType.SelectedValue.ToString()))
+				{
+                    MessageBox.Show("请选择检验类型", this.Text,
+                        MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    return;
+				}
+                if (string.IsNullOrWhiteSpace(this.txtFilePath.Text.ToString()))
+                {
+                    MessageBox.Show("请选择导出路径", this.Text,
+                        MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    return;
+                }
+                string createtimeBegin = this.dtpCreateTimeBegin.Value.ToString("yyyy-MM-dd");
+                string createtimeEnd = this.dtpCreateTimeEnd.Value.ToString("yyyy-MM-dd");
+                DialogResult dr = MessageBox.Show("是否导出【" + createtimeBegin + "】至【" + createtimeEnd+ "】的数据。",
+                    this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
+
+                if (dr != DialogResult.Yes)
+                {
+                    return;
+                }
+
+                string directory = Path.GetDirectoryName(this.txtFilePath.Text);      // 获取目录
+                string fileName = Path.GetFileName(this.txtFilePath.Text);           // 获取文件名(含扩展名) 
+
+                ClientRequestEntity cre = new ClientRequestEntity();
+                cre.NameSpace = "F_RPT_080114";
+                cre.Name = "ExportData";
+                cre.Properties["CheckType"] = this.cmbCheckType.SelectedValue;
+                cre.Properties["CreatetimeBegin"] = createtimeBegin;
+                cre.Properties["CreatetimeEnd"] = createtimeEnd;
+                cre.Properties["FilePath"] = directory;
+                cre.Properties["FileName"] = fileName;
+
+                ServiceResultEntity sre = (ServiceResultEntity)DoAsync(() =>
+                {
+                    return PCModuleProxyNew.Service.HandleRequest(cre);
+                });
+				if (sre.Message == "无数据")
+				{
+                    MessageBox.Show("该范围内无数据", this.Text,
+                        MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    return;
+                } 
+                // 将Base64字符串转换为字节数组
+                byte[] fileBytes = Convert.FromBase64String(sre.Message);
+                // 保存到用户选择的路径
+                File.WriteAllBytes(this.txtFilePath.Text, fileBytes);
+
+                // 然后打开导出完成的窗口,显示文件路径
+                MinimalExportForm f = new MinimalExportForm(this.txtFilePath.Text);
+                DialogResult dialogResult = f.ShowDialog();
+            }
+            catch (Exception ex)
+            {
+                // 对异常进行共通处理
+                ExceptionManager.HandleEventException(this.ToString(),
+                    MethodBase.GetCurrentMethod().Name, this.Text, ex);
+            }
+        }
+
+		private void tsbtnchooesfile_Click(object sender, EventArgs e)
+		{
+            // 弹出保存对话框
+            using (SaveFileDialog saveDialog = new SaveFileDialog())
+            {
+                saveDialog.Filter = "Excel文件 (*.xlsx)|*.xlsx";
+                saveDialog.FileName =  $"QC检验数据_{DateTime.Now:yyyyMMdd_HHmmss}.xlsx";
+
+                // 如果有现有路径,使用它
+                if (!string.IsNullOrEmpty(txtFilePath.Text))
+                {
+                    string dir = Path.GetDirectoryName(txtFilePath.Text);
+                    if (Directory.Exists(dir))
+                    {
+                        saveDialog.InitialDirectory = dir;
+                    }
+                }
+                else
+                {
+                    saveDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
+                }
+
+                if (saveDialog.ShowDialog() == DialogResult.OK)
+                {
+                    // 将选择的路径写入文本框
+                    txtFilePath.Text = saveDialog.FileName;
+                }
+            }
+        }
+	}
+}

+ 137 - 0
DK.Client/ReportModule/R08/F_RPT_08011401.resx

@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="btnSave.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAFUAAAAeCAYAAABdalL1AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        vAAADrwBlbxySQAAAI5JREFUaEPt0KERxCAUQMFrEImOowUsioJSAb3gaOLfnLjJRMNzT2wD+ymlhPb1
+        3mOMEWutMPUQUwGmAkwFmAowFWAqwFSAqQBTAaYCTAWYCnilXtcV2tdaM/U0UwGmAmqtT2rOObTvnzrn
+        NPUUUwGmAkwFmAowFWAqwFSAqYBf6n3fpp70Sk0phfY9qTO+PIZEBQZ3CrAAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="tsbtnchooesfile.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAFUAAAAeCAYAAABdalL1AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        vAAADrwBlbxySQAAAI5JREFUaEPt0KERxCAUQMFrEImOowUsioJSAb3gaOLfnLjJRMNzT2wD+ymlhPb1
+        3mOMEWutMPUQUwGmAkwFmAowFWAqwFSAqQBTAaYCTAWYCnilXtcV2tdaM/U0UwGmAmqtT2rOObTvnzrn
+        NPUUUwGmAkwFmAowFWAqwFSAqYBf6n3fpp70Sk0phfY9qTO+PIZEBQZ3CrAAAAAASUVORK5CYII=
+</value>
+  </data>
+</root>

+ 15 - 0
DK.Client/ReportModule/ReportModule.csproj

@@ -443,6 +443,9 @@
     <Compile Include="R04\M01\F_RPT_040116.Designer.cs">
       <DependentUpon>F_RPT_040116.cs</DependentUpon>
     </Compile>
+    <Compile Include="R08\ExportForm.cs">
+      <SubType>Form</SubType>
+    </Compile>
     <Compile Include="R08\F_RPT_080118.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -551,6 +554,12 @@
     <Compile Include="R08\F_RPT_080107.Designer.cs">
       <DependentUpon>F_RPT_080107.cs</DependentUpon>
     </Compile>
+    <Compile Include="R08\F_RPT_08011401.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="R08\F_RPT_08011401.Designer.cs">
+      <DependentUpon>F_RPT_08011401.cs</DependentUpon>
+    </Compile>
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="Properties\Resources.resx">
@@ -728,6 +737,9 @@
     <EmbeddedResource Include="R04\M01\F_RPT_040116.resx">
       <DependentUpon>F_RPT_040116.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="R08\ExportForm.resx">
+      <DependentUpon>ExportForm.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="R08\F_RPT_080118.resx">
       <DependentUpon>F_RPT_080118.cs</DependentUpon>
     </EmbeddedResource>
@@ -782,6 +794,9 @@
     <EmbeddedResource Include="R08\F_RPT_080107.resx">
       <DependentUpon>F_RPT_080107.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="R08\F_RPT_08011401.resx">
+      <DependentUpon>F_RPT_08011401.cs</DependentUpon>
+    </EmbeddedResource>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\DK.Basics\BaseControls\BaseControls.csproj">

+ 17 - 1
DK.Service/CommonModuleLogic/CommonModuleLogic.csproj

@@ -76,21 +76,37 @@
     <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="EPPlus">
+      <HintPath>..\..\DK.Basics\BaseControls\DLL\EPPlus.dll</HintPath>
+    </Reference>
+    <Reference Include="NPOI">
+      <HintPath>..\..\DK.Basics\BaseControls\DLL\NPOI.dll</HintPath>
+    </Reference>
+    <Reference Include="NPOI.OOXML">
+      <HintPath>..\..\DK.Basics\BaseControls\DLL\NPOI.OOXML.dll</HintPath>
+    </Reference>
+    <Reference Include="NPOI.OpenXml4Net">
+      <HintPath>..\..\DK.Basics\BaseControls\DLL\NPOI.OpenXml4Net.dll</HintPath>
+    </Reference>
+    <Reference Include="NPOI.OpenXmlFormats">
+      <HintPath>..\..\DK.Basics\BaseControls\DLL\NPOI.OpenXmlFormats.dll</HintPath>
+    </Reference>
     <Reference Include="Oracle.ManagedDataAccess, Version=4.122.19.1, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\DLL\Oracle.ManagedDataAccess.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="System.Drawing" />
     <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="CommonModuleLogic.cs" />
+    <Compile Include="ExportExcel_EPPlus.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>

+ 267 - 0
DK.Service/CommonModuleLogic/ExportExcel_EPPlus.cs

@@ -0,0 +1,267 @@
+using OfficeOpenXml;
+using OfficeOpenXml.Style;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Drawing;
+using System.IO;
+
+public class ExcelExportService
+{
+    public static byte[] ExportDataTableToBytes(DataTable dataTable, Dictionary<string, string> customHeaders = null)
+    {
+        try
+        {
+            if (dataTable == null || dataTable.Rows.Count == 0)
+            {
+                throw new ArgumentException("数据表不能为空");
+            }
+
+            using (var package = new ExcelPackage())
+            {
+                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
+
+                // 写入列标题
+                WriteHeaders(worksheet, dataTable, customHeaders);
+
+                // 写入数据行
+                WriteData(worksheet, dataTable);
+
+                // 应用格式
+                ApplyFormatting(worksheet, dataTable);
+
+                return package.GetAsByteArray();
+            }
+        }
+        catch (Exception ex)
+        {
+            throw new Exception($"导出失败: {ex.Message}", ex);
+        }
+    }
+    /// <summary>
+    /// 导出DataTable到Excel并返回文件信息
+    /// </summary>
+    public static ExportResult ExportDataTable(DataTable dataTable, string exportPath,
+                                              string fileName = null,
+                                              Dictionary<string, string> customHeaders = null)
+    {
+        try
+        {
+            if (dataTable == null || dataTable.Rows.Count == 0)
+            {
+                return ExportResult.Error("数据表不能为空");
+            } 
+
+            // 确保目录存在
+            if (!Directory.Exists(exportPath))
+            {
+                Directory.CreateDirectory(exportPath);
+            }
+
+            // 生成文件名
+            if (string.IsNullOrEmpty(fileName))
+            {
+                fileName = $"QC检验数据_{DateTime.Now:yyyyMMdd_HHmmss}.xlsx";
+            }
+            else if (!fileName.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase))
+            {
+                fileName += ".xlsx";
+            }
+
+            string filePath = Path.Combine(exportPath, fileName);
+
+            // 确保文件名唯一
+            filePath = GetUniqueFilePath(filePath);
+
+            // 导出Excel
+            using (var package = new ExcelPackage())
+            {
+                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
+
+                // 写入列标题
+                WriteHeaders(worksheet, dataTable, customHeaders);
+
+                // 写入数据行
+                WriteData(worksheet, dataTable);
+
+                // 应用格式
+                ApplyFormatting(worksheet, dataTable);
+
+                // 保存文件
+                package.SaveAs(new FileInfo(filePath));
+            }
+
+            // 返回导出结果
+            return ExportResult.SuccessResult(filePath, fileName, dataTable.Rows.Count);
+        }
+        catch (Exception ex)
+        {
+            return ExportResult.Error($"导出失败: {ex.Message}");
+        }
+    }
+      
+    /// <summary>
+    /// 获取唯一文件名
+    /// </summary>
+    private static string GetUniqueFilePath(string filePath)
+    {
+        if (!File.Exists(filePath))
+            return filePath;
+
+        string directory = Path.GetDirectoryName(filePath);
+        string fileNameWithoutExt = Path.GetFileNameWithoutExtension(filePath);
+        string extension = Path.GetExtension(filePath);
+
+        int counter = 1;
+        string newFilePath;
+
+        do
+        {
+            newFilePath = Path.Combine(directory,
+                $"{fileNameWithoutExt}_{counter}{extension}");
+            counter++;
+        } while (File.Exists(newFilePath));
+
+        return newFilePath;
+    }
+
+    /// <summary>
+    /// 写入列标题
+    /// </summary>
+    private static void WriteHeaders(ExcelWorksheet worksheet, DataTable dataTable,
+                                   Dictionary<string, string> customHeaders)
+    {
+        for (int i = 0; i < dataTable.Columns.Count; i++)
+        {
+            string headerText = dataTable.Columns[i].ColumnName;
+
+            if (customHeaders != null && customHeaders.ContainsKey(headerText))
+            {
+                headerText = customHeaders[headerText];
+            }
+
+            worksheet.Cells[1, i + 1].Value = headerText;
+        }
+
+        // 设置标题样式
+        using (var range = worksheet.Cells[1, 1, 1, dataTable.Columns.Count])
+        {
+            range.Style.Font.Bold = true;
+            range.Style.Font.Size = 11;
+            range.Style.Fill.PatternType = ExcelFillStyle.Solid;
+            range.Style.Fill.BackgroundColor.SetColor(Color.LightBlue);
+            range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
+            range.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
+        }
+    }
+
+    /// <summary>
+    /// 写入数据
+    /// </summary>
+    private static void WriteData(ExcelWorksheet worksheet, DataTable dataTable)
+    {
+        for (int row = 0; row < dataTable.Rows.Count; row++)
+        {
+            for (int col = 0; col < dataTable.Columns.Count; col++)
+            {
+                object value = dataTable.Rows[row][col];
+
+                if (value == DBNull.Value || value == null)
+                {
+                    worksheet.Cells[row + 2, col + 1].Value = "";
+                }
+                else if (dataTable.Columns[col].DataType == typeof(DateTime))
+                {
+                    worksheet.Cells[row + 2, col + 1].Value = value;
+                    worksheet.Cells[row + 2, col + 1].Style.Numberformat.Format = "yyyy-mm-dd hh:mm:ss";
+                }
+                else if (dataTable.Columns[col].DataType == typeof(bool))
+                {
+                    worksheet.Cells[row + 2, col + 1].Value = (bool)value ? "是" : "否";
+                }
+                else
+                {
+                    worksheet.Cells[row + 2, col + 1].Value = value;
+                }
+            }
+        }
+    }
+
+    /// <summary>
+    /// 应用格式
+    /// </summary>
+    private static void ApplyFormatting(ExcelWorksheet worksheet, DataTable dataTable)
+    {
+        if (worksheet.Dimension == null) return;
+
+        // 设置数据区域边框
+        using (var range = worksheet.Cells[worksheet.Dimension.Address])
+        {
+            range.Style.Border.Top.Style = ExcelBorderStyle.Thin;
+            range.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
+            range.Style.Border.Left.Style = ExcelBorderStyle.Thin;
+            range.Style.Border.Right.Style = ExcelBorderStyle.Thin;
+        }
+
+        // 自动调整列宽
+        worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
+    }
+
+    /// <summary>
+    /// 获取默认导出目录
+    /// </summary>
+    public static string GetDefaultExportPath(string filename)
+    {
+        string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
+        string exportFolder = Path.Combine(desktopPath, filename);
+
+        if (!Directory.Exists(exportFolder))
+        {
+            Directory.CreateDirectory(exportFolder);
+        }
+
+        return exportFolder;
+    }
+}
+
+/// <summary>
+/// 导出结果
+/// </summary>
+public class ExportResult
+{
+    public bool Success { get; set; }
+    public string Message { get; set; }
+    public string FilePath { get; set; }
+    public string FileName { get; set; }
+    public string FullPath { get; set; }
+    public int RecordCount { get; set; }
+    public DateTime ExportTime { get; set; }
+    public long FileSize { get; set; }
+
+    public static ExportResult SuccessResult(string filePath, string fileName, int recordCount)
+    {
+        var fileInfo = new FileInfo(filePath);
+
+        return new ExportResult
+        {
+            Success = true,
+            Message = "导出成功",
+            FilePath = filePath,
+            FileName = fileName,
+            FullPath = filePath,
+            RecordCount = recordCount,
+            ExportTime = DateTime.Now,
+            FileSize = fileInfo.Exists ? fileInfo.Length : 0
+        };
+    }
+
+    public static ExportResult Error(string errorMessage)
+    {
+        return new ExportResult
+        {
+            Success = false,
+            Message = errorMessage,
+            ExportTime = DateTime.Now
+        };
+    }
+}

+ 137 - 0
DK.Service/PCModuleService/PCModuleLogic.cs

@@ -7567,6 +7567,143 @@ from TP_PM_FQCITEMSDATA p
             }
         }
 
+        /// <summary>
+        /// 导出明细
+        /// </summary>
+        /// <param name="sUserInfo"></param>
+        /// <returns></returns>
+        public static ServiceResultEntity ExportData(SUserInfo sUserInfo, ClientRequestEntity cre)
+        {
+            ServiceResultEntity sre = new ServiceResultEntity();
+            IDBConnection con = ClsDbFactory.CreateDBConnection(DataBaseType.ORACLE, DataManager.ConnectionString);
+            try
+            {
+                string checkType = cre.Properties["CheckType"].ToString();
+                DateTime createtimebegin = Convert.ToDateTime(cre.Properties["CreatetimeBegin"]);
+                DateTime createtimeend = Convert.ToDateTime(cre.Properties["CreatetimeEnd"]);
+                string sqlString = "";
+                if (checkType == "1")
+				{
+                    DataTable itemsiddt = con.GetSqlResultToDt($@"SELECT LISTAGG(ITEMSID, ',') WITHIN GROUP(ORDER BY ITEMSID) AS ITEMSID
+                                    FROM tp_pm_fqcitems WHERE inspecttype<> 615 ");
+
+                    sqlString = @"SELECT    p.barcode || '[' || gdd.goodscode || ']' as 产品条码 ,
+                                 p.inspectitem AS 检验项目
+                                              ,fd.technicalrequirement AS 检验依据
+                                              ,CASE
+                                                   WHEN tpf.inspectmark = 630 THEN
+                                                    CASE
+                                                        WHEN p.isqualified = 1 THEN
+                                                         '合格'
+                                                        ELSE
+                                                         '不合格'
+                                                    END
+                                                   ELSE
+                                                    to_char(p.inspectvalue)
+                                               END AS 检验结果
+                                          FROM tp_pm_fqcitemsdata p 
+                                       LEFT JOIN tp_pm_fqcitemsdetail tpf  ON p.inspectitem = tpf.inspectitem  AND p.itemsid = tpf.itemsid
+                                          LEFT JOIN tp_pm_fqcitemsdetail fd
+                                            ON fd.itemsdetailid = p.itemsdetailid
+                                          LEFT JOIN tp_pm_groutingdailydetail gdd
+                                            ON gdd.barcode = p.barcode
+                                  WHERE p.VALUEFLAG =1  
+                                      AND p.CREATETIME>=:CREATETIMEBEGIN
+                                      AND p.CREATETIME<=:CREATETIMEEND
+                                      AND p.ITEMSID NOT in (" + itemsiddt.Rows[0]["ITEMSID"].ToString() + " ) order by p.barcode || '[' || gdd.goodscode || ']' ";
+
+                }
+                else if(checkType == "2") 
+                { 
+                    DataTable itemsiddt = con.GetSqlResultToDt($@"SELECT LISTAGG(ITEMSID, ',') WITHIN GROUP(ORDER BY ITEMSID) AS ITEMSID
+                                    FROM tp_pm_fqcitems WHERE inspecttype<> 615 and valueflag = 1 ");
+
+                    sqlString = @" SELECT   p.barcode || '[' || gdd.goodscode || ']' as 产品条码 ,
+                                                       fi.INSPECTNAME AS 检验标准名称
+                                                      ,p.inspectitem AS 检验项目 
+                                                      ,fd.technicalrequirement AS 检验依据
+                                                      ,CASE WHEN tpf.inspectmark = 630 THEN
+                                                            CASE WHEN p.isqualified = 1 THEN
+                                                                 '合格'
+                                                                ELSE
+                                                                 '不合格'
+                                                            END
+                                                           ELSE
+                                                            to_char(p.inspectvalue)
+                                                       END AS 检验结果
+                                                  FROM tp_pm_fqcitemsdata p 
+                                               LEFT JOIN tp_pm_fqcitemsdetail tpf  ON p.inspectitem = tpf.inspectitem  AND p.itemsid = tpf.itemsid
+                                                  LEFT JOIN tp_pm_fqcitemsdetail fd
+                                                    ON fd.itemsdetailid = p.itemsdetailid
+                                                  LEFT JOIN tp_pm_groutingdailydetail gdd
+                                                    ON gdd.barcode = p.barcode
+                                                    LEFT JOIN tp_pm_fqcitems fi
+                                                    ON fi.ITEMSID = p.ITEMSID
+                                          WHERE p.VALUEFLAG =1  
+                                              AND p.CREATETIME>=:CREATETIMEBEGIN
+                                              AND p.CREATETIME<=:CREATETIMEEND
+                                              AND p.ITEMSID in( " + itemsiddt.Rows[0]["ITEMSID"].ToString() + " ) order by p.barcode || '[' || gdd.goodscode || ']'";
+
+                }
+                else if (checkType == "3")
+                {
+                    sqlString = @"SELECT  p.barcode as 产品条码 ,
+                         p.itemsname AS 检验项目
+                                      ,p.itemsinfo AS 检验依据
+                                      ,  CASE
+                                                WHEN p.itemsvalue = 1 THEN
+                                                 '一致'
+                                                ELSE
+                                                 '不一致' 
+                                       END AS 检验结果 FROM tp_pm_firstregisterdetail p
+                        WHERE p.CREATETIME >=:CREATETIMEBEGIN
+                        AND p.CREATETIME<=:CREATETIMEEND   ";
+
+                }
+
+                OracleParameter[] parameters = new OracleParameter[]
+                {
+                    new OracleParameter(":CREATETIMEBEGIN", OracleDbType.Date, createtimebegin, ParameterDirection.Input),
+                    new OracleParameter(":CREATETIMEEND", OracleDbType.Date, createtimeend, ParameterDirection.Input),
+                };
+
+                DataTable resultDt = con.GetSqlResultToDt(sqlString, parameters);
+                if (resultDt == null || resultDt.Rows.Count == 0)
+                {
+                    sre.Message = "无数据";
+                    return sre;
+                }
+
+                // 导出Excel为字节数组
+                byte[] excelBytes;
+                try
+                {
+                    excelBytes = ExcelExportService.ExportDataTableToBytes(resultDt);
+                }
+                catch (Exception ex)
+                {
+                    sre.Message = $"导出失败:{ex.Message}";
+                    return sre;
+                }
+
+                // 将字节数组转换为Base64字符串
+                string base64String = Convert.ToBase64String(excelBytes);
+                sre.Message = base64String;
+                return sre; 
+                 
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            finally
+            {
+                if (con.ConnState == ConnectionState.Open)
+                {
+                    con.Close();
+                }
+            }
+        }
         #endregion
 
 

+ 32 - 29
DK.Service/SystemModuleLogic/SystemModuleLogic.cs

@@ -8198,7 +8198,7 @@ namespace Dongke.IBOSS.PRD.Service.SystemModuleLogic
 				"            WHERE G.MATERIALCODE = '"+ dtable.Rows[0]["materialcode"].ToString() + "')  t\n" +
 				"            LEFT JOIN TP_MST_GOODS G ON G.GOODSID = T.GOODSID\n" +
 				"            LEFT JOIN TP_MST_LOGO L ON L.LOGOID = T.LOGOID\n" +
-				"			 WHERE  G.VALUEFLAG = 1";
+				"			 WHERE  G.VALUEFLAG = 1  and G.SCRAPSUMFLAG = 1 AND G.GOODS_LINE_TYPE = " + dtable.Rows[0]["GOODS_LINE_TYPE"].ToString() ;
 
 
 				DataTable dsResult = oracleConn.GetSqlResultToDt(sqlString);
@@ -8226,34 +8226,37 @@ namespace Dongke.IBOSS.PRD.Service.SystemModuleLogic
 					}
 					else
 					{
-						//一对多,查询高压标识
-						DataRow[] rows = dsResult.Select("GOODS_LINE_TYPE = " + dtable.Rows[0]["GOODS_LINE_TYPE"].ToString());
-						if (rows != null && rows.Count() > 0)
-						{ 
-							for (int i = 0; i < dtable.Rows.Count; i++)
-							{
-								dtable.Rows[i]["GOODSID"] = rows[0]["GOODSID"].ToString();
-								dtable.Rows[i]["LOGOID"] = rows[0]["LOGOID"].ToString();
-								dtable.Rows[i]["GOODSCODE"] = rows[0]["GOODSCODE"].ToString();
-								dtable.Rows[i]["LOGONAME"] = rows[0]["LOGONAME"].ToString();
-							}
-							sre.Data = new DataSet();
-							sre.Data.Tables.Add(dtable.Copy());
-							return sre;
-						}
-						else
-						{
-							for (int i = 0; i < dtable.Rows.Count; i++)
-							{
-								dtable.Rows[i]["GOODSID"] = dsResult.Rows[0]["GOODSID"].ToString();
-								dtable.Rows[i]["LOGOID"] = dsResult.Rows[0]["LOGOID"].ToString();
-								dtable.Rows[i]["GOODSCODE"] = dsResult.Rows[0]["GOODSCODE"].ToString();
-								dtable.Rows[i]["LOGONAME"] = dsResult.Rows[0]["LOGONAME"].ToString();
-							}
-							sre.Data = new DataSet();
-							sre.Data.Tables.Add(dtable.Copy());
-							return sre;
-						}
+						//未找对匹配数据,请核对
+						sre.Message = "在调入工厂找到多条该物料匹配数据,请核对;物料:【" + dtable.Rows[0]["materialcode"].ToString() + "】";
+						return sre;
+						////一对多,查询高压标识
+						//DataRow[] rows = dsResult.Select("GOODS_LINE_TYPE = " + dtable.Rows[0]["GOODS_LINE_TYPE"].ToString());
+						//if (rows != null && rows.Count() > 0)
+						//{ 
+						//	for (int i = 0; i < dtable.Rows.Count; i++)
+						//	{
+						//		dtable.Rows[i]["GOODSID"] = rows[0]["GOODSID"].ToString();
+						//		dtable.Rows[i]["LOGOID"] = rows[0]["LOGOID"].ToString();
+						//		dtable.Rows[i]["GOODSCODE"] = rows[0]["GOODSCODE"].ToString();
+						//		dtable.Rows[i]["LOGONAME"] = rows[0]["LOGONAME"].ToString();
+						//	}
+						//	sre.Data = new DataSet();
+						//	sre.Data.Tables.Add(dtable.Copy());
+						//	return sre;
+						//}
+						//else
+						//{
+						//	for (int i = 0; i < dtable.Rows.Count; i++)
+						//	{
+						//		dtable.Rows[i]["GOODSID"] = dsResult.Rows[0]["GOODSID"].ToString();
+						//		dtable.Rows[i]["LOGOID"] = dsResult.Rows[0]["LOGOID"].ToString();
+						//		dtable.Rows[i]["GOODSCODE"] = dsResult.Rows[0]["GOODSCODE"].ToString();
+						//		dtable.Rows[i]["LOGONAME"] = dsResult.Rows[0]["LOGONAME"].ToString();
+						//	}
+						//	sre.Data = new DataSet();
+						//	sre.Data.Tables.Add(dtable.Copy());
+						//	return sre;
+						//}
 					}
 				}
 				else

+ 4 - 0
WCF.Service/WCF.Services/PCModuleServiceNew.cs

@@ -728,6 +728,10 @@ namespace Dongke.IBOSS.PRD.WCF.Services
                     {
                         return ServiceInvoker.Invoke(this, () => PCModuleLogic.GetDaochuData(this.SUserInfo, cre));
                     }
+                    if ("ExportData" == cre.Name)
+                    {
+                        return ServiceInvoker.Invoke(this, () => PCModuleLogic.ExportData(this.SUserInfo, cre));
+                    }
                 }
                 #endregion
 

Vissa filer visades inte eftersom för många filer har ändrats