HSE费用修改

This commit is contained in:
2025-11-17 20:31:53 +08:00
parent 1325b721a2
commit 0fd29567b1
12 changed files with 252 additions and 28 deletions
@@ -28,9 +28,33 @@ namespace FineUIPro.Web.HJGL.PreDesign
/// 绑定数据
/// </summary>
private void BindGrid()
{
BindGrid(false);
}
/// <summary>
/// 绑定数据(带筛选参数)
/// </summary>
/// <param name="isFilter">是否应用筛选条件</param>
private void BindGrid(bool isFilter)
{
Model.HJGL_TrainNumberManage table = new Model.HJGL_TrainNumberManage();
table.ProjectId = this.CurrUser.LoginProjectId;
// 应用筛选条件
if (isFilter)
{
if (!string.IsNullOrEmpty(txtTrainNumber.Text.Trim()))
{
table.TrainNumber = txtTrainNumber.Text.Trim();
}
if (!string.IsNullOrEmpty(ddlState.SelectedValue))
{
table.State = Convert.ToInt32(ddlState.SelectedValue);
}
}
var tb = BLL.TrainNumberManageService.GetListByQueryModle(table, Grid1.PageIndex+1, Grid1.PageSize);
Grid1.RecordCount = tb.Total;
Grid1.DataSource = tb.Data;
@@ -39,7 +63,54 @@ namespace FineUIPro.Web.HJGL.PreDesign
}
#endregion
#region
/// <summary>
/// 转换状态值
/// </summary>
/// <param name="state">状态值</param>
/// <returns>状态文本</returns>
protected string ConvertState(object state)
{
if (state != null)
{
int stateValue = Convert.ToInt32(state);
switch (stateValue)
{
case 0: return "未发货";
case 1: return "已发货";
case 2: return "已验收";
default: return "";
}
}
return "";
}
#endregion
#region GV
/// <summary>
/// 筛选按钮点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnFilter_Click(object sender, EventArgs e)
{
this.Grid1.PageIndex = 0; // 重置到第一页
this.BindGrid(true);
}
/// <summary>
/// 清除筛选按钮点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnClearFilter_Click(object sender, EventArgs e)
{
txtTrainNumber.Text = "";
ddlState.SelectedValue = "";
this.Grid1.PageIndex = 0; // 重置到第一页
this.BindGrid(false);
}
/// <summary>
/// 过滤表头
/// </summary>
@@ -209,15 +280,28 @@ namespace FineUIPro.Web.HJGL.PreDesign
= x.LicensePlateNumber,
= x.ContactName,
= x.ContactPhone,
= ConvertState(x.State),
= x.ReceiveDate?.ToString("g") ?? "",
= x.Remark
});
// 根据筛选条件生成文件名
string fileName = "车次管理";
if (!string.IsNullOrEmpty(txtTrainNumber.Text.Trim()))
{
fileName += "-发货编号_" + txtTrainNumber.Text.Trim();
}
if (!string.IsNullOrEmpty(ddlState.SelectedValue))
{
fileName += "-状态_" + ddlState.SelectedItem.Text;
}
fileName += "-" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx";
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();