fix:安装清单页面4项修改(过滤裕-量、预制组件数量=1、隐藏预制工作包列、修复导出IOException)、预制组件管理页面过滤裕-量、材料匹配算法预扣除出库申请单材料
This commit is contained in:
@@ -13,7 +13,6 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
public partial class InstallList : PageBase
|
||||
{
|
||||
public int pageSize = 20;
|
||||
public static IQueryable<View_HJGL_InstallData> GridDataTable = null;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -232,35 +231,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
try
|
||||
{
|
||||
var baseQuery = from x in Funs.DB.View_HJGL_InstallData select x;
|
||||
|
||||
// 应用与数据绑定相同的筛选条件
|
||||
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID);
|
||||
}
|
||||
else if (tvControlItem.SelectedNode.CommandName == "流水段")
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.ParentNode.NodeID && x.FlowingSection == tvControlItem.SelectedNode.Text);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(txtPipelineCode2.Text))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode2.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(txtPipelineComponentCode.Text))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.Code.Contains(txtPipelineComponentCode.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(drpTypeStr.SelectedValue))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.TypeStr.Contains(drpTypeStr.SelectedValue));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(txtPipelineCode.Text))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim()));
|
||||
}
|
||||
|
||||
var baseQuery = GetIQueryableInstallDatas();
|
||||
// 计算汇总数据
|
||||
var componentCount = baseQuery.Count(x => x.TypeStr == "预制组件");
|
||||
var partCount = baseQuery.Count(x => x.TypeStr == "预制散件");
|
||||
@@ -283,27 +254,46 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
/// <returns></returns>
|
||||
private List<View_HJGL_InstallData> BindData(int pageIndex, int pageSize, out int totalCount)
|
||||
{
|
||||
var baseQuery = GetIQueryableInstallDatas();
|
||||
totalCount = baseQuery.Count();
|
||||
// 分页保护
|
||||
if (pageIndex <= 0) pageIndex = 1;
|
||||
if (pageSize <= 0) pageSize = 10;
|
||||
var query = baseQuery.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
|
||||
// 预制组件数量显示为1,预制散件保持原始数量
|
||||
foreach (var item in query)
|
||||
{
|
||||
if (item.TypeStr == "预制组件")
|
||||
{
|
||||
item.Number = 1;
|
||||
}
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
var baseQuery=from x in Funs.DB.View_HJGL_InstallData
|
||||
select x;
|
||||
|
||||
private IQueryable<View_HJGL_InstallData> GetIQueryableInstallDatas()
|
||||
{
|
||||
var baseQuery = from x in Funs.DB.View_HJGL_InstallData
|
||||
select x;
|
||||
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID);
|
||||
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID);
|
||||
}
|
||||
else if (tvControlItem.SelectedNode.CommandName == "流水段")
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.ParentNode.NodeID && x.FlowingSection == tvControlItem.SelectedNode.Text);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(txtPipelineCode2.Text))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode2.Text.Trim()));
|
||||
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(txtPipelineComponentCode.Text))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.Code.Contains(txtPipelineComponentCode.Text.Trim()));
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(drpTypeStr.SelectedValue))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.TypeStr.Contains(drpTypeStr.SelectedValue));
|
||||
@@ -315,19 +305,15 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
//}
|
||||
if (!string.IsNullOrEmpty(txtPipelineCode.Text))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim()));
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim()));
|
||||
|
||||
}
|
||||
}
|
||||
// 过滤组件编号/材料编码值为"裕-量"的记录
|
||||
baseQuery = baseQuery.Where(x => x.Code != "裕-量");
|
||||
baseQuery = baseQuery.OrderBy(x => x.PipelineCode).ThenBy(x => x.Code);
|
||||
totalCount = baseQuery.Count();
|
||||
GridDataTable = baseQuery;
|
||||
// 分页保护
|
||||
if (pageIndex <= 0) pageIndex = 1;
|
||||
if (pageSize <= 0) pageSize = 10;
|
||||
var query = baseQuery.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
|
||||
return query;
|
||||
}
|
||||
|
||||
return baseQuery;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 分页排序
|
||||
@@ -418,16 +404,18 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (GridDataTable != null)
|
||||
{
|
||||
var q = (from x in GridDataTable
|
||||
|
||||
var baseQuery = GetIQueryableInstallDatas();
|
||||
|
||||
var q = (from x in baseQuery
|
||||
where x.Code != "裕-量"
|
||||
select new
|
||||
{
|
||||
管线号 = x.PipelineCode,
|
||||
类型 = x.TypeStr,
|
||||
编号 = x.Code,
|
||||
预制散件材料描述 = (x.Matdef=="" || x.Matdef==null)?"-":x.Matdef,
|
||||
数量 = x.Number??1,
|
||||
数量 = x.TypeStr == "预制组件" ? 1 : (x.Number ?? 1),
|
||||
所在包装编号 = x.PackagingCode,
|
||||
车次 = x.TrainNumber,
|
||||
流水段 = x.FlowingSection
|
||||
@@ -435,7 +423,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
string path = Funs.RootPath + @"File\Excel\Temp\PrePipelineInstallList.xlsx";
|
||||
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx");
|
||||
|
||||
MiniExcel.SaveAs(path, q);
|
||||
MiniExcel.SaveAs(path, q, overwriteFile: true);
|
||||
|
||||
string fileName = $"安装清单-" + this.tvControlItem.SelectedNode.Text + "-" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx";
|
||||
FileInfo info = new FileInfo(path);
|
||||
@@ -448,7 +436,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(path);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user