焊接管理修改

This commit is contained in:
2025-08-28 15:41:32 +08:00
parent edebefa3c9
commit 87bbd83e25
24 changed files with 444 additions and 170 deletions
@@ -1,6 +1,9 @@
using BLL;
using MiniExcelLibs;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
@@ -11,7 +14,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
{
public partial class TrainNumberManager : PageBase
{
public static List<Model.HJGL_TrainNumberManage> hJGL_TrainNumberManages=new List<Model.HJGL_TrainNumberManage>();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
@@ -35,6 +38,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
Grid1.RecordCount = tb.Total;
Grid1.DataSource = tb.Data;
Grid1.DataBind();
hJGL_TrainNumberManages= tb.Data;
}
#endregion
@@ -187,7 +191,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
}
}
}
#endregion
#endregion
#region
/// 导出按钮
@@ -196,17 +200,39 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// <param name="e"></param>
protected void btnOut_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;
this.Grid1.PageSize = 500;
this.BindGrid();
Response.Write(GetGridTableHtml(Grid1));
Response.End();
}
if (hJGL_TrainNumberManages != null)
{
var q = hJGL_TrainNumberManages
.Select((x, index) => new
{
= index + 1, // 自增序号,从 1 开始
= x.TrainNumber,
= x.DriverName,
= x.DriverPhone,
= x.LicensePlateNumber,
= x.ContactName,
= x.ContactPhone,
= x.Remark
});
string path = Funs.RootPath + @"File\Excel\Temp\TrainNumberManager.xlsx";
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx");
MiniExcel.SaveAs(path, q);
string fileName = $"车次管理-"+ string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".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);
}
}
/// <summary>
/// 导出方法
/// </summary>
@@ -257,17 +283,50 @@ namespace FineUIPro.Web.HJGL.PreDesign
protected void btnPrint_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID))
string Id = this.Grid1.SelectedRowID;
Pring(Id);
}
private void Pring(string Id)
{
BLL.FastReportService.ResetData();
if (string.IsNullOrEmpty(Id))
{
string id = Grid1.SelectedRowID;
string url = "TrainNumberManagerPrint.aspx?TrainNumberId={0}";
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format(url, id, "打印 - ")));
}
else
{
Alert.ShowInTop("请选择要打印的数据", MessageBoxIcon.Warning);
ShowNotify("请选择要打印的项", MessageBoxIcon.Warning);
return;
}
DataTable tb = LINQToDataTable(HJGL_PackagingmanageService.GetPackagingManage(Id));
if (tb.Rows.Count > 0)
{
var model = TrainNumberManageService.GetModelById(Id);
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
keyValuePairs.Add("ProjectName", ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId));
keyValuePairs.Add("TrainNumber", model.TrainNumber);
keyValuePairs.Add("Remark", model.Remark);
keyValuePairs.Add("ContactName", model.ContactName );
keyValuePairs.Add("ContactPhone", model.ContactPhone);
keyValuePairs.Add("ID", "TrainNumberManager$" + model.Id);
DataRow dataRow = tb.NewRow();
dataRow["PackagingCode"] = "合计:" + tb.Rows.Count;
tb.Rows.Add(dataRow);
if (tb != null)
{
tb.TableName = "Data";
}
BLL.FastReportService.AddFastreportTable(tb);
BLL.FastReportService.AddFastreportParameter(keyValuePairs);
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
initTemplatePath = "File\\Fastreport\\发货单.frx";
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
}
}
}
}
}