diff --git a/.vs/SGGL_SeDin_New/v17/.wsuo b/.vs/SGGL_SeDin_New/v17/.wsuo index 2db9ef7e..c9ebe860 100644 Binary files a/.vs/SGGL_SeDin_New/v17/.wsuo and b/.vs/SGGL_SeDin_New/v17/.wsuo differ diff --git a/.vs/SGGL_SeDin_New/v17/DocumentLayout.backup.json b/.vs/SGGL_SeDin_New/v17/DocumentLayout.backup.json new file mode 100644 index 00000000..526a4537 --- /dev/null +++ b/.vs/SGGL_SeDin_New/v17/DocumentLayout.backup.json @@ -0,0 +1,83 @@ +{ + "Version": 1, + "WorkspaceRootPath": "D:\\\u6570\u636E\\\u8BFA\u5FC5\u8FBE\\\u8D5B\u9F0E\\SGGL_SeDin_New\\", + "Documents": [], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 386, + "SelectedChildIndex": -1, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{e506b91c-c606-466a-90a9-123d1d1e12b3}" + }, + { + "$type": "Bookmark", + "Name": "ST:130:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:132:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:133:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:134:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:1:0:{f2bd8fb8-fc94-3dae-a733-fd993c73cc87}" + }, + { + "$type": "Bookmark", + "Name": "ST:131:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:129:0:{13b12e3e-c1b4-4539-9371-4fe9a0d523fc}" + }, + { + "$type": "Bookmark", + "Name": "ST:2:0:{f2bd8fb8-fc94-3dae-a733-fd993c73cc87}" + }, + { + "$type": "Bookmark", + "Name": "ST:3:0:{f2bd8fb8-fc94-3dae-a733-fd993c73cc87}" + }, + { + "$type": "Bookmark", + "Name": "ST:129:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{1a46fd64-28d5-434c-8eb3-17a02d419b53}" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{5726b0e3-1012-5233-81f9-d1fad48e7a56}" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/SGGL/BLL/CLGL/TwInputmasterService.cs b/SGGL/BLL/CLGL/TwInputmasterService.cs index 85279101..0a532b5e 100644 --- a/SGGL/BLL/CLGL/TwInputmasterService.cs +++ b/SGGL/BLL/CLGL/TwInputmasterService.cs @@ -292,8 +292,13 @@ namespace BLL TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType.入库, detailTable.ActNum); } - plan.State= (int)TwConst.State.已完成; - TwInOutplanmasterService.Update(plan); + var planTable =TwInOutplanmasterService.GetById(plan.Id); + if (planTable != null) + { + planTable.State = (int)TwConst.State.已完成; + TwInOutplanmasterService.Update(planTable); + } + } /// /// 根据计划单撤销入库单 diff --git a/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs b/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs index 1f6b5ed3..160c451a 100644 --- a/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/WeldJointService.cs @@ -455,17 +455,96 @@ namespace BLL } public static List GetViewWeldJointsBymodel(Model.View_HJGL_WeldJoint model) { - var q = (from x in Funs.DB.View_HJGL_WeldJoint - where - (string.IsNullOrEmpty(model.ProjectId) || x.ProjectId.Contains(model.ProjectId)) - && (string.IsNullOrEmpty(model.UnitWorkId) || x.UnitWorkId.Contains(model.UnitWorkId)) - && (string.IsNullOrEmpty(model.PipelineId) || x.PipelineId.Contains(model.PipelineId)) - && (string.IsNullOrEmpty(model.PipelineCode) || x.PipelineCode.Contains(model.PipelineCode)) - && (string.IsNullOrEmpty(model.WeldJointCode) || x.WeldJointCode.Contains(model.WeldJointCode)) - orderby x.WeldJointCode - select x).AsParallel().ToList(); - return q; + var baseQuery = from x in Funs.DB.View_HJGL_WeldJoint select x; + if (!string.IsNullOrEmpty(model.ProjectId)) + baseQuery = baseQuery.Where(x => x.ProjectId == model.ProjectId); + if (!string.IsNullOrEmpty(model.UnitWorkId)) + baseQuery = baseQuery.Where(x => x.UnitWorkId == model.UnitWorkId); + if (!string.IsNullOrEmpty(model.PipelineId)) + baseQuery = baseQuery.Where(x => x.PipelineId == model.PipelineId); + if (!string.IsNullOrEmpty(model.PipelineCode)) + baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(model.PipelineCode)); + if (!string.IsNullOrEmpty(model.WeldJointCode)) + baseQuery = baseQuery.Where(x => x.WeldJointCode.Contains(model.WeldJointCode)); + + return baseQuery.ToList(); } + public static IEnumerable GetIEnumerableViewWeldJointsBymodel(Model.View_HJGL_WeldJoint model) + { + var baseQuery = from x in Funs.DB.View_HJGL_WeldJoint select x; + if (!string.IsNullOrEmpty(model.ProjectId)) + baseQuery = baseQuery.Where(x => x.ProjectId == model.ProjectId); + if (!string.IsNullOrEmpty(model.UnitWorkId)) + baseQuery = baseQuery.Where(x => x.UnitWorkId == model.UnitWorkId); + if (!string.IsNullOrEmpty(model.PipelineId)) + baseQuery = baseQuery.Where(x => x.PipelineId == model.PipelineId); + if (!string.IsNullOrEmpty(model.PipelineCode)) + baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(model.PipelineCode)); + if (!string.IsNullOrEmpty(model.WeldJointCode)) + baseQuery = baseQuery.Where(x => x.WeldJointCode.Contains(model.WeldJointCode)); + + return baseQuery.ToList() ; + } + public static (List Data, int Total)GetDataBymodel(Model.View_HJGL_WeldJoint model, int pageIndex = 0, int pageSize = 20) + { + // 阶段一:构建基础查询 + var baseQuery = Funs.DB.View_HJGL_WeldJoint.AsQueryable(); + + // 阶段二:构建动态查询条件 + if (!string.IsNullOrEmpty(model.ProjectId)) + baseQuery = baseQuery.Where(x => x.ProjectId == model.ProjectId); + if (!string.IsNullOrEmpty(model.UnitWorkId)) + baseQuery = baseQuery.Where(x => x.UnitWorkId == model.UnitWorkId); + if (!string.IsNullOrEmpty(model.PipelineId)) + baseQuery = baseQuery.Where(x => x.PipelineId == model.PipelineId); + if (!string.IsNullOrEmpty(model.PipelineCode)) + baseQuery = baseQuery.Where(x => x.PipelineCode .Contains(model.PipelineCode)); + if (!string.IsNullOrEmpty(model.WeldJointCode)) + baseQuery = baseQuery.Where(x => x.WeldJointCode.Contains( model.WeldJointCode)); + + // 阶段三:排序与分页控制(索引优化关键) + var orderedQuery = baseQuery.OrderBy(x => x.WeldJointCode); + + // 阶段四:分页执行(数据库层面分页) + var pagedData = orderedQuery + .Skip((pageIndex ) * pageSize) + .Take(pageSize) + .ToList(); + + // 获取总记录数(延迟计数优化) + var totalCount = baseQuery.Count(); + + return (pagedData, totalCount); + } + public static List GetViewWeldJointsBymodel(Model.View_HJGL_WeldJoint model, int pageIndex = 0, int pageSize = 20) + { + // 阶段一:构建基础查询 + var baseQuery = Funs.DB.View_HJGL_WeldJoint.AsQueryable(); + + // 阶段二:构建动态查询条件 + if (!string.IsNullOrEmpty(model.ProjectId)) + baseQuery = baseQuery.Where(x => x.ProjectId == model.ProjectId); + if (!string.IsNullOrEmpty(model.UnitWorkId)) + baseQuery = baseQuery.Where(x => x.UnitWorkId == model.UnitWorkId); + if (!string.IsNullOrEmpty(model.PipelineId)) + baseQuery = baseQuery.Where(x => x.PipelineId == model.PipelineId); + if (!string.IsNullOrEmpty(model.PipelineCode)) + baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(model.PipelineCode)); + if (!string.IsNullOrEmpty(model.WeldJointCode)) + baseQuery = baseQuery.Where(x => x.WeldJointCode.Contains(model.WeldJointCode)); + + // 阶段三:排序与分页控制(索引优化关键) + var orderedQuery = baseQuery.OrderBy(x => x.WeldJointCode); + + // 阶段四:分页执行(数据库层面分页) + var pagedData = orderedQuery + .Skip((pageIndex) * pageSize) + .Take(pageSize) + .ToList(); + + return pagedData; + } + /// /// 根据壁厚计算焊口达因 /// diff --git a/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx.cs b/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx.cs index 9976c2be..6acf52fe 100644 --- a/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/ArrivalStatistics.aspx.cs @@ -12,6 +12,12 @@ namespace FineUIPro.Web.CLGL { public partial class ArrivalStatistics : PageBase { + #region Methods + + protected void btnSearch_Click(object sender, EventArgs e) + { + BindGrid(); + } protected void Page_Load(object sender, EventArgs e) { @@ -20,14 +26,17 @@ namespace FineUIPro.Web.CLGL drpWarehouse.DataTextField = "Text"; drpWarehouse.DataValueField = "Value"; drpWarehouse.DataSource = BLL.DropListService.HJGL_WarehouseCode(); - drpWarehouse.DataBind(); + drpWarehouse.DataBind(); this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString(); // 绑定表格 - // this.BindGrid(); + // this.BindGrid(); } } + #endregion Methods + #region 绑定数据 + /// /// 绑定数据 /// @@ -61,14 +70,14 @@ namespace FineUIPro.Web.CLGL if (model?.MatchRate < 1 || model?.MatchRate == null) { Grid1.Rows[i].RowCssClass = "red"; - } } } - #endregion + #endregion 绑定数据 #region GV 数据操作 + /// /// 过滤表头 /// @@ -79,6 +88,17 @@ namespace FineUIPro.Web.CLGL // this.BindGrid(); //} + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue); + this.BindGrid(); + } + /// /// 分页 /// @@ -101,20 +121,10 @@ namespace FineUIPro.Web.CLGL this.Grid1.SortField = e.SortField; this.BindGrid(); } - - /// - /// 分页显示条数下拉框 - /// - /// - /// - protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) - { - this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue); - this.BindGrid(); - } - #endregion + #endregion GV 数据操作 #region 关闭弹出窗 + /// /// 关闭弹出窗 /// @@ -124,11 +134,11 @@ namespace FineUIPro.Web.CLGL { BindGrid(); } - #endregion - + #endregion 关闭弹出窗 #region 导出按钮 + /// 导出按钮 /// /// @@ -182,11 +192,7 @@ namespace FineUIPro.Web.CLGL return sb.ToString(); } - #endregion - protected void btnSearch_Click(object sender, EventArgs e) - { - BindGrid(); - } + #endregion 导出按钮 } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx.cs b/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx.cs index 22f05340..01bbcadb 100644 --- a/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx.cs +++ b/SGGL/FineUIPro.Web/CLGL/InPlanMaster.aspx.cs @@ -15,6 +15,7 @@ namespace FineUIPro.Web.CLGL { public partial class InPlanMaster : PageBase { + #region Methods protected void Page_Load(object sender, EventArgs e) { @@ -27,34 +28,27 @@ namespace FineUIPro.Web.CLGL } } - #region 绑定数据 - private void InitDrpList() - { - this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString(); - drpWarehouse.DataTextField = "Text"; - drpWarehouse.DataValueField = "Value"; - drpWarehouse.DataSource = BLL.DropListService .HJGL_WarehouseCode(); - drpWarehouse.DataBind(); - Funs.FineUIPleaseSelect(this.drpWarehouse); - drpTypeInt.DataTextField = "Key"; - drpTypeInt.DataValueField = "Value"; - drpTypeInt.DataSource = BLL.TwConst.TypeIntMap.Where(x=>x.Key.Contains("入库")); - drpTypeInt.DataBind(); - Funs.FineUIPleaseSelect(this.drpTypeInt); - drpStates.DataTextField = "Key"; - drpStates.DataValueField = "Value"; - drpStates.DataSource = BLL.TwConst.StateMap; - drpStates.DataBind(); - Funs.FineUIPleaseSelect(this.drpStates); + #endregion Methods + #region 绑定数据 + + private void BindDetailGrid(string inOutPlanMasterId) + { + Model.Tw_InOutDetailOutput table = new Model.Tw_InOutDetailOutput(); + table.InOutPlanMasterId = inOutPlanMasterId; + table.MaterialCode = txtMaterialCode.Text; + var tb = BLL.TwInOutplandetailService.GetListData(table, Grid2); + Grid2.DataSource = tb; + Grid2.DataBind(); } + /// /// 绑定数据 /// private void BindGrid() { Model.Tw_InOutMasterOutput table = new Model.Tw_InOutMasterOutput(); - table.ProjectId=this.CurrUser.LoginProjectId; + table.ProjectId = this.CurrUser.LoginProjectId; table.InOutType = (int?)TwConst.InOutType.入库; if (drpTypeInt.SelectedValue != Const._Null) { @@ -69,25 +63,38 @@ namespace FineUIPro.Web.CLGL table.WarehouseCode = drpWarehouse.SelectedValue; } var tb = BLL.TwInOutplanmasterService.GetListData(table, Grid1); - Grid1.RecordCount = TwInOutplanmasterService.Count; + Grid1.RecordCount = TwInOutplanmasterService.Count; Grid1.DataSource = tb; Grid1.DataBind(); - Grid2.DataSource=null; + Grid2.DataSource = null; Grid2.DataBind(); } - private void BindDetailGrid(string inOutPlanMasterId) + + private void InitDrpList() { - Model.Tw_InOutDetailOutput table = new Model.Tw_InOutDetailOutput(); - table.InOutPlanMasterId = inOutPlanMasterId; - table.MaterialCode = txtMaterialCode.Text; - var tb = BLL.TwInOutplandetailService.GetListData(table, Grid2); - Grid2.DataSource = tb; - Grid2.DataBind(); + this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString(); + drpWarehouse.DataTextField = "Text"; + drpWarehouse.DataValueField = "Value"; + drpWarehouse.DataSource = BLL.DropListService.HJGL_WarehouseCode(); + drpWarehouse.DataBind(); + Funs.FineUIPleaseSelect(this.drpWarehouse); + drpTypeInt.DataTextField = "Key"; + drpTypeInt.DataValueField = "Value"; + drpTypeInt.DataSource = BLL.TwConst.TypeIntMap.Where(x => x.Key.Contains("入库")); + drpTypeInt.DataBind(); + Funs.FineUIPleaseSelect(this.drpTypeInt); + drpStates.DataTextField = "Key"; + drpStates.DataValueField = "Value"; + drpStates.DataSource = BLL.TwConst.StateMap; + drpStates.DataBind(); + Funs.FineUIPleaseSelect(this.drpStates); } - #endregion + + #endregion 绑定数据 #region GV 数据操作 + /// /// 过滤表头 /// @@ -98,6 +105,17 @@ namespace FineUIPro.Web.CLGL // this.BindGrid(); //} + /// + /// 分页显示条数下拉框 + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue); + this.BindGrid(); + } + /// /// 分页 /// @@ -109,6 +127,15 @@ namespace FineUIPro.Web.CLGL this.BindGrid(); } + protected void Grid1_RowClick(object sender, GridRowClickEventArgs e) + { + if (e.RowIndex >= 0) + { + string ID = Grid1.DataKeys[e.RowIndex][0].ToString(); + BindDetailGrid(ID); + } + } + /// /// 排序 /// @@ -120,41 +147,45 @@ namespace FineUIPro.Web.CLGL this.Grid1.SortField = e.SortField; this.BindGrid(); } - protected void Grid1_RowClick(object sender, GridRowClickEventArgs e) + + protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) { - if (e.RowIndex >= 0) + if (e.CommandName == "btnInPlanMasterPrint") { - string ID = Grid1.DataKeys[e.RowIndex][0].ToString(); - BindDetailGrid(ID); + Print(e.RowID); } } - /// - /// 分页显示条数下拉框 - /// - /// - /// - protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) - { - this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue); - this.BindGrid(); - } - #endregion + + #endregion GV 数据操作 #region 数据编辑事件 - protected void btnSearch_Click(object sender, EventArgs e) - { - BindGrid(); - } - /// - /// 新增 + /// 批量删除 /// /// /// - protected void btnImport_Click(object sender, EventArgs e) + protected void btnDelete_Click(object sender, EventArgs e) { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InPlanMasterDataIn.aspx?", "导入 - "))); + if (Grid1.SelectedRowIndexArray.Length > 0) + { + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + var model = BLL.TwInOutplanmasterService.GetById(rowID); + if (model.State == (int)TwConst.State.已审核 || model.State == (int)TwConst.State.已完成) + { + Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning); + return; + } + else + { + BLL.TwInOutplanmasterService.DeleteById(rowID); + BindGrid(); + ShowNotify("删除数据成功!", MessageBoxIcon.Success); + } + } + } } /// @@ -177,70 +208,6 @@ namespace FineUIPro.Web.CLGL } } - /// - /// Grid行双击事件 - /// - /// - /// - protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) - { - this.btnEdit_Click(null, null); - } - - /// - /// 批量删除 - /// - /// - /// - protected void btnDelete_Click(object sender, EventArgs e) - { - if (Grid1.SelectedRowIndexArray.Length > 0) - { - foreach (int rowIndex in Grid1.SelectedRowIndexArray) - { - string rowID = Grid1.DataKeys[rowIndex][0].ToString(); - var model = BLL.TwInOutplanmasterService.GetById(rowID); - if (model.State == (int)TwConst.State.已审核|| model.State == (int)TwConst.State.已完成) - { - Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning); - return; - } - else - { - BLL.TwInOutplanmasterService.DeleteById(rowID); - BindGrid(); - ShowNotify("删除数据成功!", MessageBoxIcon.Success); - } - } - - - } - } - protected void btnPassMaster_OnClick(object sender, EventArgs e) - { - if (Grid1.SelectedRowIndexArray.Length == 0) - { - Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); - return; - } - string planId = Grid1.SelectedRowID; - var planMaster = BLL.TwInOutplanmasterService.GetById(planId); - if (planMaster.State != (int)TwConst.State.待审核) - { - Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning); - return; - } - else - { - planMaster.State = (int)TwConst.State.已审核; - planMaster.AuditMan=this.CurrUser.PersonId; - planMaster.AuditDate = DateTime.Now; - TwInOutplanmasterService.Update(planMaster); - ShowNotify("审核通过!", MessageBoxIcon.Success); - BindGrid(); - } - - } protected void btnGenInMaster_Click(object sender, EventArgs e) { if (Grid1.SelectedRowIndexArray.Length == 0) @@ -258,23 +225,56 @@ namespace FineUIPro.Web.CLGL else { PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InPlanMasterEdit.aspx?Id={0}", Grid1.SelectedRowID, "编辑 - "))); - } - //if ( planMaster.State != (int)TwConst.State.已审核) - //{ - // Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning); - // return; - //} - //else - //{ - // TwInputmasterService.GenInMasterByPlanId(planId); - // BindGrid(); - // ShowNotify("生成入库单成功!", MessageBoxIcon.Success); - //} + //if ( planMaster.State != (int)TwConst.State.已审核) + //{ + // Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning); + // return; + //} + //else + //{ + // TwInputmasterService.GenInMasterByPlanId(planId); + // BindGrid(); + // ShowNotify("生成入库单成功!", MessageBoxIcon.Success); + //} + } + /// + /// 新增 + /// + /// + /// + protected void btnImport_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InPlanMasterDataIn.aspx?", "导入 - "))); + } + + protected void btnPassMaster_OnClick(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; } + string planId = Grid1.SelectedRowID; + var planMaster = BLL.TwInOutplanmasterService.GetById(planId); + if (planMaster.State != (int)TwConst.State.待审核) + { + Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning); + return; + } + else + { + planMaster.State = (int)TwConst.State.已审核; + planMaster.AuditMan = this.CurrUser.PersonId; + planMaster.AuditDate = DateTime.Now; + TwInOutplanmasterService.Update(planMaster); + ShowNotify("审核通过!", MessageBoxIcon.Success); + BindGrid(); + } + } - protected void btnRevokeGenInMaster_Click(object sender, EventArgs e) + protected void btnRevokeGenInMaster_Click(object sender, EventArgs e) { if (Grid1.SelectedRowIndexArray.Length == 0) { @@ -292,13 +292,29 @@ namespace FineUIPro.Web.CLGL { TwInputmasterService.RevokeGenInMasterByPlanId(planId); BindGrid(); - ShowNotify("撤销入库单成功!",MessageBoxIcon.Success); - } - + ShowNotify("撤销入库单成功!", MessageBoxIcon.Success); + } } - #endregion + + protected void btnSearch_Click(object sender, EventArgs e) + { + BindGrid(); + } + + /// + /// Grid行双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.btnEdit_Click(null, null); + } + + #endregion 数据编辑事件 #region 关闭弹出窗 + /// /// 关闭弹出窗 /// @@ -308,9 +324,11 @@ namespace FineUIPro.Web.CLGL { BindGrid(); } - #endregion + + #endregion 关闭弹出窗 #region 获取权限按钮 + /// /// 获取按钮权限 /// @@ -342,9 +360,11 @@ namespace FineUIPro.Web.CLGL } } } - #endregion + + #endregion 获取权限按钮 #region 导出按钮 + /// 导出按钮 /// /// @@ -399,21 +419,18 @@ namespace FineUIPro.Web.CLGL return sb.ToString(); } - #endregion + #endregion 导出按钮 - protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) + protected void txtMaterialCode_OnTextChanged(object sender, EventArgs e) { - if (e.CommandName == "btnInPlanMasterPrint") - { - Print(e.RowID); - } + BindDetailGrid(Grid1.SelectedRowID); } + private void Print(string Id) { BLL.FastReportService.ResetData(); if (string.IsNullOrEmpty(Id)) { - ShowNotify("请选择要打印的项", MessageBoxIcon.Warning); return; } @@ -422,12 +439,11 @@ namespace FineUIPro.Web.CLGL { Id = Id }; - var result =TwInOutplanmasterService.GetListData(queryModel).FirstOrDefault(); + var result = TwInOutplanmasterService.GetListData(queryModel).FirstOrDefault(); List tw_PrintMasters = new List(); List tw_PrintDetails = new List(); Model.Tw_PrintMaster printMaster = new Model.Tw_PrintMaster { - ReqUnitName = result.ReqUnitName, CusBillCode = result.CusBillCode, CreateDate = result.CreateDate.Value.ToString("yyyy-MM-dd"), @@ -452,47 +468,47 @@ namespace FineUIPro.Web.CLGL { InOutPlanMasterId = Id }; - var ListDetailRelation =TwInoutplandetailRelationService.GetTw_InOutPlanDetail_RelationByModle(queryModel2).ToList(); + var ListDetailRelation = TwInoutplandetailRelationService.GetTw_InOutPlanDetail_RelationByModle(queryModel2).ToList(); int SortIndex = 1; int SortIndex2 = 1; - var tw_PrintDetailRelation=(from x in ListDetailRelation - join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode - join z in Funs.DB.HJGL_Pipeline on x.PipelineId equals z.PipelineId - join m in Funs.DB.WBS_UnitWork on z.UnitWorkId equals m.UnitWorkId - select new Model.Tw_PrintDetail - { - SortIndex=SortIndex++, - PipelineCode=z.PipelineCode, - PipelineComponentCode=x.PrefabricatedComponents, - MaterialCode=y.MaterialCode, - MaterialDef=y.MaterialDef, - MaterialSpec=y.MaterialSpec, - MaterialUnit=y.MaterialUnit, - PlanNum = (x.Number ?? 0).ToString(), - UnitWorkName = m.UnitWorkName, - }).ToList(); - var UnitWorkName= tw_PrintDetailRelation.FirstOrDefault()?.UnitWorkName; - Tw_PrintDetail tw_PrintDetailRelation2 = new Tw_PrintDetail - { - MaterialDef = "材料编码合计" - }; - var tw_PrintDetail = ( from x in Funs.DB.Tw_InOutPlanDetail - join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode - where x.InOutPlanMasterId==Id - orderby x.SortIndex + var tw_PrintDetailRelation = (from x in ListDetailRelation + join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode + join z in Funs.DB.HJGL_Pipeline on x.PipelineId equals z.PipelineId + join m in Funs.DB.WBS_UnitWork on z.UnitWorkId equals m.UnitWorkId select new Model.Tw_PrintDetail { - SortIndex =0, - PipelineCode = "-", - PipelineComponentCode = "-", + SortIndex = SortIndex++, + PipelineCode = z.PipelineCode, + PipelineComponentCode = x.PrefabricatedComponents, MaterialCode = y.MaterialCode, MaterialDef = y.MaterialDef, MaterialSpec = y.MaterialSpec, MaterialUnit = y.MaterialUnit, - PlanNum = (x.PlanNum ?? 0).ToString(), - ActNum = (x.ActNum ?? 0).ToString(), - UnitWorkName = UnitWorkName, + PlanNum = (x.Number ?? 0).ToString(), + UnitWorkName = m.UnitWorkName, }).ToList(); + var UnitWorkName = tw_PrintDetailRelation.FirstOrDefault()?.UnitWorkName; + Tw_PrintDetail tw_PrintDetailRelation2 = new Tw_PrintDetail + { + MaterialDef = "材料编码合计" + }; + var tw_PrintDetail = (from x in Funs.DB.Tw_InOutPlanDetail + join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode + where x.InOutPlanMasterId == Id + orderby x.SortIndex + select new Model.Tw_PrintDetail + { + SortIndex = 0, + PipelineCode = "-", + PipelineComponentCode = "-", + MaterialCode = y.MaterialCode, + MaterialDef = y.MaterialDef, + MaterialSpec = y.MaterialSpec, + MaterialUnit = y.MaterialUnit, + PlanNum = (x.PlanNum ?? 0).ToString(), + ActNum = (x.ActNum ?? 0).ToString(), + UnitWorkName = UnitWorkName, + }).ToList(); foreach (var item in tw_PrintDetail) { item.SortIndex = SortIndex2++; @@ -507,7 +523,7 @@ namespace FineUIPro.Web.CLGL } BLL.FastReportService.ResetData(); BLL.FastReportService.AddFastreportTable(Table1); - BLL.FastReportService.AddFastreportTable(Data); + BLL.FastReportService.AddFastreportTable(Data); string initTemplatePath = ""; string rootPath = Server.MapPath("~/"); initTemplatePath = "File\\Fastreport\\材料入库计划单.frx"; @@ -515,13 +531,7 @@ namespace FineUIPro.Web.CLGL if (File.Exists(rootPath + initTemplatePath)) { PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); - } } - - protected void txtMaterialCode_OnTextChanged(object sender, EventArgs e) - { - BindDetailGrid(Grid1.SelectedRowID); - } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx b/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx index 60734d65..7499a7e4 100644 --- a/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx +++ b/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -99,7 +99,7 @@ namespace FastReport } - + @@ -149,7 +149,7 @@ namespace FastReport - + @@ -164,7 +164,7 @@ namespace FastReport - + diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index fd310b8d..884338d2 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -153,6 +153,9 @@ ..\packages\System.Text.Encoding.CodePages.4.5.0\lib\net461\System.Text.Encoding.CodePages.dll + + ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll + diff --git a/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx.cs b/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx.cs index 6c1e79d4..3cbf319c 100644 --- a/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/InfoQuery/JointQuery.aspx.cs @@ -11,6 +11,7 @@ using System.Drawing; using System.IO; using System.Linq; using System.Text; +using System.Web; using AspNet = System.Web.UI.WebControls; namespace FineUIPro.Web.HJGL.InfoQuery @@ -287,24 +288,33 @@ namespace FineUIPro.Web.HJGL.InfoQuery { Model.View_HJGL_WeldJoint model = new Model.View_HJGL_WeldJoint(); model.ProjectId = this.CurrUser.LoginProjectId; + model.WeldJointCode = this.txtWeldJointCode.Text; + if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2) { model.UnitWorkId = this.tvControlItem.SelectedNodeID; - + model.WeldJointCode = this.txtWeldJointCode.Text; + var list = BLL.WeldJointService.GetDataBymodel(model, Grid1.PageIndex, Grid1.PageSize); + Grid1.RecordCount = list.Total; + Grid1.DataSource = list.Data; + Grid1.DataBind(); } else if (this.tvControlItem.SelectedNode.CommandName == "管线") { model.PipelineId = this.tvControlItem.SelectedNodeID; - + var list = BLL.WeldJointService.GetViewWeldJointsBymodel(model); + View_HJGL_WeldJoint = list; + Grid1.RecordCount = list.Count; + var table = list.Skip(Grid1.PageSize * (Grid1.PageIndex)).Take(Grid1.PageSize).ToList(); + Grid1.DataSource = table; + Grid1.DataBind(); } - model.WeldJointCode = this.txtWeldJointCode.Text; - var list = BLL.WeldJointService.GetViewWeldJointsBymodel(model); - View_HJGL_WeldJoint = list; - Grid1.RecordCount = list.Count; - // var table = this.GetPagedDataTable(Grid1, list); - var table = list.Skip(Grid1.PageSize * (Grid1.PageIndex)).Take(Grid1.PageSize).ToList(); - Grid1.DataSource = table; - Grid1.DataBind(); + + + + + + } @@ -477,14 +487,15 @@ namespace FineUIPro.Web.HJGL.InfoQuery /// protected void btnOut_Click(object sender, EventArgs e) { - if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2) + if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2) //单位工程 { Model.View_HJGL_WeldJoint model = new Model.View_HJGL_WeldJoint(); - model.ProjectId = this.CurrUser.LoginProjectId; model.UnitWorkId = this.tvControlItem.SelectedNodeID; var list = BLL.WeldJointService.GetViewWeldJointsBymodel(model); View_HJGL_WeldJoint = list; - } + /* PrintByUnitWork(this.tvControlItem.SelectedNodeID); + return;*/ + } string path = Funs.RootPath + @"File\Excel\Temp\JointQuery.xlsx"; path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd-HH-mm}", DateTime.Now) + ".xlsx"); @@ -546,6 +557,89 @@ namespace FineUIPro.Web.HJGL.InfoQuery //Response.Write(GetGridTableHtml(Grid1)); //Response.End(); } + protected void PrintByUnitWork(string unitWorkId) + { + const int pageSize = 10000; + int pageIndex = 0; + bool isFirstPage = true; + var model = new Model.View_HJGL_WeldJoint + { + ProjectId = this.CurrUser.LoginProjectId, + UnitWorkId = unitWorkId + }; + + // 生成唯一文件路径(带GUID哈希值) + string path = $@"{Funs.RootPath}File\Excel\Temp\JointQuery_{Guid.NewGuid().GetHashCode():x}.xlsx"; + var AllData = new List(); + using (var excelStream = new FileStream(path, FileMode.Create)) + { + while (true) + { + // 分页获取数据 + var pageData = BLL.WeldJointService.GetDataBymodel(model, pageIndex, pageSize); + + if (!pageData.Data.Any()) break; + + // 动态转换查询结果 + var currentChunk = pageData.Data.Select(x => new + { + 焊口号 = x.WeldJointCode, + 完成状态 = x.IsWeldOK, + 单位名称 = x.UnitName, + 流水段 = x.FlowingSection, + 材质1 = x.Material1Code, + 材质2 = x.Material2Code, + 达因 = x.Size, + 外径 = x.Dia, + 壁厚 = x.Thickness, + 规格 = x.Specification, + 焊缝类型 = x.WeldTypeCode, + 焊接方法 = x.WeldingMethodCode, + WPS编号 = x.WPQCode, + 坡口类型 = x.GrooveTypeCode, + 焊条 = x.WeldingRodCode, + 焊丝 = x.WeldingWireCode, + 预热温度 = x.PreTemperature, + 焊口属性 = x.JointAttribute, + 焊接日期 = x.WeldingDate, + 打底焊工号 = x.BackingWelderCode, + 打底焊工班组 = x.BackingWelderTeamGroupName, + 盖面焊工号 = x.CoverWelderCode, + 盖面焊工班组 = x.CoverWelderTeamGroupName, + 热处理报告编号 = x.HotProessReportNo, + 热处理检测结果 = x.HotProessResult, + 硬度报告编号 = x.HardReportNo, + 硬度检测结果 = x.HardResult, + 委托单编号 = x.TrustBatchCode, + 检测单编号 = x.NDECode, + 探伤类型 = x.DetectionTypeCode, + 探伤比例 = x.DetectionRateCode + + }).ToList(); + + AllData.AddRange(currentChunk); + // 内存清理 & 翻页操作 + currentChunk = null; + pageIndex++; + GC.Collect(GC.MaxGeneration, GCCollectionMode.Optimized, blocking: true); + } + + MiniExcel.SaveAs(path, AllData ); + + } + 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); // 多保险清理机制 + } + protected void btnOutNOComPipeline_Click(object sender, EventArgs e) { if (this.tvControlItem.SelectedNode.CommandName.Split('|').Count() == 2)