2023-02-20 10:49:51 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
|
using MiniExcelLibs;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.HJGL.WeldingManage
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
public partial class WeldMatMatchGet : PageBase
|
|
|
|
|
|
{
|
2025-10-10 14:33:21 +08:00
|
|
|
|
public static List<string> pipelinecode = new List<string>();
|
2023-02-20 10:49:51 +08:00
|
|
|
|
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
var UnitWorkId = Request.Params["UnitWorkId"];
|
|
|
|
|
|
var PipeArea = Request.Params["PipeArea"];
|
2025-10-10 14:33:21 +08:00
|
|
|
|
// txtProgressBar.Text = "20";
|
2023-02-20 10:49:51 +08:00
|
|
|
|
GetStockNum(UnitWorkId, PipeArea);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-10-10 14:33:21 +08:00
|
|
|
|
public void GetStockNum(string UnitWorkId, string PipeArea)
|
2023-02-20 10:49:51 +08:00
|
|
|
|
{
|
|
|
|
|
|
var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == UnitWorkId && x.PipeArea == PipeArea
|
|
|
|
|
|
orderby x.PipelineCode
|
|
|
|
|
|
select x).ToList();
|
|
|
|
|
|
List<string> pipelineList = new List<string>();
|
|
|
|
|
|
foreach (var item in pipeline)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool istrue = BLL.HJGL_MaterialService.isInStockByPipeline(item.PipelineId, this.CurrUser.LoginProjectId);
|
|
|
|
|
|
if (istrue)
|
|
|
|
|
|
{
|
|
|
|
|
|
pipelineList.Add(item.PipelineCode);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
pipelinecode = pipelineList;
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnOut_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
string path = Funs.RootPath + @"File\Excel\Temp\weldMatchGet.xlsx";
|
|
|
|
|
|
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx");
|
|
|
|
|
|
var a = (from x in pipelinecode select new { PipelineCode = x }).ToList();
|
2025-10-10 14:33:21 +08:00
|
|
|
|
var b = (from x in Funs.DB.HJGL_Pipeline
|
|
|
|
|
|
where pipelinecode.Contains(x.PipelineCode)
|
|
|
|
|
|
select new { 管线号 = x.PipelineCode, 流水段 = x.FlowingSection, 匹配率 = "100%", 计划安装日期 = x.PlanStartDate }).ToList();
|
2023-02-20 10:49:51 +08:00
|
|
|
|
MiniExcel.SaveAs(path, b);
|
|
|
|
|
|
|
|
|
|
|
|
string fileName = "材料匹配100%管线.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);
|
|
|
|
|
|
}
|
|
|
|
|
|
void BindGrid()
|
|
|
|
|
|
{
|
2023-02-21 16:36:13 +08:00
|
|
|
|
var a = (from x in pipelinecode select new { PipelineCode = x }).ToList();
|
|
|
|
|
|
var b = (from x in Funs.DB.HJGL_Pipeline
|
|
|
|
|
|
where pipelinecode.Contains(x.PipelineCode)
|
|
|
|
|
|
select new { PipelineCode = x.PipelineCode, FlowingSection = x.FlowingSection, MatchingRate = "100%", PlanStarDate = x.PlanStartDate }).ToList();
|
2023-02-20 10:49:51 +08:00
|
|
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
2023-02-21 16:36:13 +08:00
|
|
|
|
this.Grid1.DataSource = b;
|
2023-02-20 10:49:51 +08:00
|
|
|
|
this.Grid1.DataBind();
|
|
|
|
|
|
Grid1.RecordCount = a.Count();
|
|
|
|
|
|
}
|
|
|
|
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|