2023-03-30 报表升级
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using BLL;
|
||||
using MiniExcelLibs;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -14,6 +16,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
public partial class PrePipeline : PageBase
|
||||
{
|
||||
public int pageSize = 20;
|
||||
public static DataTable GridDataTable=new DataTable ();
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -284,7 +287,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
GridDataTable = tb;
|
||||
// 2.获取当前分页数据
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
@@ -558,33 +561,32 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
public string ConvertState(object state)
|
||||
{
|
||||
string StateName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(state.ToString()))
|
||||
if (state != null)
|
||||
{
|
||||
|
||||
if (state != null)
|
||||
if (!string.IsNullOrEmpty(state.ToString()))
|
||||
{
|
||||
string txt = HJGL_PipelineComponentService.GetState().FirstOrDefault(x => x.Value == state.ToString()).Text;
|
||||
|
||||
return txt;
|
||||
|
||||
}
|
||||
return "";
|
||||
}
|
||||
return StateName;
|
||||
}
|
||||
public string ConvertProductionState(object state)
|
||||
{
|
||||
string StateName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(state.ToString()))
|
||||
if (state != null)
|
||||
{
|
||||
|
||||
if (state != null)
|
||||
if (!string.IsNullOrEmpty(state.ToString()))
|
||||
{
|
||||
|
||||
|
||||
string txt = HJGL_PipelineComponentService.GetProductionState().FirstOrDefault(x => x.Value == state.ToString()).Text;
|
||||
|
||||
return txt;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
return StateName;
|
||||
}
|
||||
protected void btnImportQRCode_Click(object sender, EventArgs e)
|
||||
@@ -619,6 +621,66 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void btnAccept_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIDArray.Length>0)
|
||||
{
|
||||
|
||||
foreach (var item in Grid1.SelectedRowIDArray)
|
||||
{
|
||||
var model = HJGL_PipelineComponentService.GetPipelineComponentById(item);
|
||||
if (model.ProductionState==2)
|
||||
{
|
||||
BLL.APIPipelineComponentService.GetComponentConfirmArrival(PipelineComponentId: item, this.CurrUser.PersonId); ;
|
||||
|
||||
}
|
||||
}
|
||||
ShowNotify("操作成功",MessageBoxIcon.Success);
|
||||
BindGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("请选择需要验收的数据", MessageBoxIcon.Warning);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (GridDataTable!=null)
|
||||
{
|
||||
var q = (from x in GridDataTable.AsEnumerable()
|
||||
select new
|
||||
{
|
||||
组件编号 = x.Field<string>("PipelineComponentCode"),
|
||||
物流箱号 = x.Field<string>("BoxNumber"),
|
||||
组件状态 = ConvertState(x.Field<object>("State")),
|
||||
生产状态 = ConvertProductionState(x.Field<object>("ProductionState")),
|
||||
管线计划安装日期 = x.Field<DateTime?>("PlanStartDate"),
|
||||
预制图纸名称 = x.Field<string>("DrawingName"),
|
||||
验收人 = x.Field<string>("PersonName"),
|
||||
验收时间 = x.Field<DateTime?>("ReceiveDate"),
|
||||
});
|
||||
string path = Funs.RootPath + @"File\Excel\Temp\PrePipeline.xlsx";
|
||||
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx");
|
||||
|
||||
MiniExcel.SaveAs(path, q);
|
||||
|
||||
string fileName = "组件信息.xlsx";
|
||||
FileInfo info = new FileInfo(path);
|
||||
long fileSize = info.Length;
|
||||
System.Web.HttpContext.Current.Response.Clear();
|
||||
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
System.Web.HttpContext.Current.Response.TransmitFile(path, 0, fileSize);
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(path);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user