diff --git a/HJGL_DS/FineUIPro.Web/HJGL/DataIn/DrawingRecognitionContent.aspx b/HJGL_DS/FineUIPro.Web/HJGL/DataIn/DrawingRecognitionContent.aspx
index 7b78483..5b83614 100644
--- a/HJGL_DS/FineUIPro.Web/HJGL/DataIn/DrawingRecognitionContent.aspx
+++ b/HJGL_DS/FineUIPro.Web/HJGL/DataIn/DrawingRecognitionContent.aspx
@@ -37,32 +37,159 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HJGL_DS/FineUIPro.Web/HJGL/DataIn/DrawingRecognitionContent.aspx.cs b/HJGL_DS/FineUIPro.Web/HJGL/DataIn/DrawingRecognitionContent.aspx.cs
index e004ae7..5f0ab53 100644
--- a/HJGL_DS/FineUIPro.Web/HJGL/DataIn/DrawingRecognitionContent.aspx.cs
+++ b/HJGL_DS/FineUIPro.Web/HJGL/DataIn/DrawingRecognitionContent.aspx.cs
@@ -100,7 +100,7 @@ namespace FineUIPro.Web.HJGL.DataIn
protected void btnSave_Click(object sender, EventArgs e)
{
- Grid1.Hidden = true;
+ TabStrip1.Hidden = true;
contentPanel1.Hidden =false ;
string rootPath = Server.MapPath("~/");
Dictionary> dic= new Dictionary>();
@@ -312,7 +312,7 @@ namespace FineUIPro.Web.HJGL.DataIn
protected void btnAudit_Click(object sender, EventArgs e)
{
- Grid1.Hidden = false;
+ TabStrip1.Hidden = false;
contentPanel1.Hidden = true;
btnAudit.Hidden = true;
btnSave.Hidden = false;
@@ -423,12 +423,98 @@ namespace FineUIPro.Web.HJGL.DataIn
private void BindGrid()
{
-
-
Grid1.DataSource = dt;
Grid1.DataBind();
+ // Grid2: 按图号合并 — 图号、类型、规格、描述相同的,数量累加
+ if (dt != null && dt.Rows.Count > 0)
+ {
+ DataTable dtGroupByDrawing = new DataTable();
+ dtGroupByDrawing.Columns.Add("id");
+ dtGroupByDrawing.Columns.Add("drawing_number");
+ dtGroupByDrawing.Columns.Add("category");
+ dtGroupByDrawing.Columns.Add("spec");
+ dtGroupByDrawing.Columns.Add("qty");
+ dtGroupByDrawing.Columns.Add("description");
+ var groups2 = dt.AsEnumerable()
+ .GroupBy(r => new
+ {
+ drawing_number = r.Field("drawing_number") ?? "",
+ category = r.Field("category") ?? "",
+ spec = r.Field("spec") ?? "",
+ description = r.Field("description") ?? ""
+ })
+ .Select(g => new
+ {
+ g.Key.drawing_number,
+ g.Key.category,
+ g.Key.spec,
+ g.Key.description,
+ qty = g.Sum(r => Funs.GetNewDecimalOrZero(r.Field("qty")))
+ });
+ foreach (var g in groups2)
+ {
+ DataRow newRow = dtGroupByDrawing.NewRow();
+ newRow["id"] = Guid.NewGuid().ToString();
+ newRow["drawing_number"] = g.drawing_number;
+ newRow["category"] = g.category;
+ newRow["spec"] = g.spec;
+ newRow["qty"] = g.qty;
+ newRow["description"] = g.description;
+ dtGroupByDrawing.Rows.Add(newRow);
+ }
+ Grid2.DataSource = dtGroupByDrawing;
+ }
+ else
+ {
+ Grid2.DataSource = null;
+ }
+ Grid2.DataBind();
+ // Grid3: 按管线号合并 — 类型、规格、描述相同的,数量累加(不展示图号)
+ if (dt != null && dt.Rows.Count > 0)
+ {
+ DataTable dtGroupByPipe = new DataTable();
+ dtGroupByPipe.Columns.Add("id");
+ dtGroupByPipe.Columns.Add("pipe_no");
+ dtGroupByPipe.Columns.Add("category");
+ dtGroupByPipe.Columns.Add("spec");
+ dtGroupByPipe.Columns.Add("qty");
+ dtGroupByPipe.Columns.Add("description");
+ var groups3 = dt.AsEnumerable()
+ .GroupBy(r => new
+ {
+ pipe_no = r.Field("pipe_no") ?? "",
+ category = r.Field("category") ?? "",
+ spec = r.Field("spec") ?? "",
+ description = r.Field("description") ?? ""
+ })
+ .Select(g => new
+ {
+ g.Key.pipe_no,
+ g.Key.category,
+ g.Key.spec,
+ g.Key.description,
+ qty = g.Sum(r => Funs.GetNewDecimalOrZero(r.Field("qty")))
+ });
+ foreach (var g in groups3)
+ {
+ DataRow newRow = dtGroupByPipe.NewRow();
+ newRow["id"] = Guid.NewGuid().ToString();
+ newRow["pipe_no"] = g.pipe_no;
+ newRow["category"] = g.category;
+ newRow["spec"] = g.spec;
+ newRow["qty"] = g.qty;
+ newRow["description"] = g.description;
+ dtGroupByPipe.Rows.Add(newRow);
+ }
+ Grid3.DataSource = dtGroupByPipe;
+ }
+ else
+ {
+ Grid3.DataSource = null;
+ }
+ Grid3.DataBind();
}
#region 双击事件
///
@@ -465,8 +551,87 @@ namespace FineUIPro.Web.HJGL.DataIn
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
- Grid1.DataSource = dt;
- Grid1.DataBind();
+ BindGrid();
}
+
+ #region 导出按钮
+ ///
+ /// 导出材料表
+ ///
+ ///
+ ///
+ protected void btnOut1_Click(object sender, EventArgs e)
+ {
+ Response.ClearContent();
+ string filename = Funs.GetNewFileName();
+ Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("材料表" + filename, System.Text.Encoding.UTF8) + ".xls");
+ Response.ContentType = "application/excel";
+ Response.ContentEncoding = System.Text.Encoding.UTF8;
+ Response.Write(GetGridTableHtml(Grid1));
+ Response.End();
+ }
+
+ ///
+ /// 导出其他区域
+ ///
+ ///
+ ///
+ protected void btnOut2_Click(object sender, EventArgs e)
+ {
+ Response.ClearContent();
+ string filename = Funs.GetNewFileName();
+ Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("图纸材料表" + filename, System.Text.Encoding.UTF8) + ".xls");
+ Response.ContentType = "application/excel";
+ Response.ContentEncoding = System.Text.Encoding.UTF8;
+ Response.Write(GetGridTableHtml(Grid2));
+ Response.End();
+ }
+
+ ///
+ /// 导出图纸信息
+ ///
+ ///
+ ///
+ protected void btnOut3_Click(object sender, EventArgs e)
+ {
+ Response.ClearContent();
+ string filename = Funs.GetNewFileName();
+ Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("管道材料表" + filename, System.Text.Encoding.UTF8) + ".xls");
+ Response.ContentType = "application/excel";
+ Response.ContentEncoding = System.Text.Encoding.UTF8;
+ Response.Write(GetGridTableHtml(Grid3));
+ Response.End();
+ }
+
+ ///
+ /// 导出方法
+ ///
+ ///
+ ///
+ private string GetGridTableHtml(Grid grid)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("");
+ sb.Append("");
+ sb.Append("");
+ foreach (GridColumn column in grid.Columns)
+ {
+ sb.AppendFormat("| {0} | ", column.HeaderText);
+ }
+ sb.Append("
");
+ foreach (GridRow row in grid.Rows)
+ {
+ sb.Append("");
+ foreach (GridColumn column in grid.Columns)
+ {
+ string html = row.Values[column.ColumnIndex].ToString();
+ sb.AppendFormat("| {0} | ", html);
+ }
+ sb.Append("
");
+ }
+ sb.Append("
");
+ return sb.ToString();
+ }
+ #endregion
}
}
\ No newline at end of file
diff --git a/HJGL_DS/FineUIPro.Web/HJGL/DataIn/DrawingRecognitionContent.aspx.designer.cs b/HJGL_DS/FineUIPro.Web/HJGL/DataIn/DrawingRecognitionContent.aspx.designer.cs
index f73611a..4eeadd1 100644
--- a/HJGL_DS/FineUIPro.Web/HJGL/DataIn/DrawingRecognitionContent.aspx.designer.cs
+++ b/HJGL_DS/FineUIPro.Web/HJGL/DataIn/DrawingRecognitionContent.aspx.designer.cs
@@ -95,6 +95,51 @@ namespace FineUIPro.Web.HJGL.DataIn
///
protected global::FineUIPro.ContentPanel contentPanel1;
+ ///
+ /// TabStrip1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.TabStrip TabStrip1;
+
+ ///
+ /// RegionPanel1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.RegionPanel RegionPanel1;
+
+ ///
+ /// Toolbar2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Toolbar Toolbar2;
+
+ ///
+ /// btnOut1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnOut1;
+
+ ///
+ /// Region2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Region Region2;
+
///
/// Grid1 控件。
///
@@ -104,6 +149,96 @@ namespace FineUIPro.Web.HJGL.DataIn
///
protected global::FineUIPro.Grid Grid1;
+ ///
+ /// RegionPanel2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.RegionPanel RegionPanel2;
+
+ ///
+ /// Toolbar3 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Toolbar Toolbar3;
+
+ ///
+ /// btnOut2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnOut2;
+
+ ///
+ /// Region3 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Region Region3;
+
+ ///
+ /// Grid2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Grid Grid2;
+
+ ///
+ /// RegionPanel3 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.RegionPanel RegionPanel3;
+
+ ///
+ /// Toolbar4 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Toolbar Toolbar4;
+
+ ///
+ /// btnOut3 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnOut3;
+
+ ///
+ /// Region4 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Region Region4;
+
+ ///
+ /// Grid3 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Grid Grid3;
+
///
/// Window1 控件。
///