From 5d4dddd465fe185a3930f7a38e45efd5a32f48f4 Mon Sep 17 00:00:00 2001 From: wendy <408182087@qq.com> Date: Tue, 3 Jun 2025 11:26:24 +0800 Subject: [PATCH] =?UTF-8?q?20250603=20=E6=8E=92=E4=BA=A7=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../版本日志/SGGLDB_V2025-05-14-001_bwj.sql | 57 ++++ SGGL/BLL/Common/Const.cs | 5 + .../ProductionSchedulingPlanService.cs | 24 +- .../File/Excel/DataOut/排产计划导出模板.xlsx | Bin 0 -> 9565 bytes .../PreDesign/ProductionSchedulingPlan.aspx | 26 +- .../ProductionSchedulingPlan.aspx.cs | 273 ++++++++++++------ SGGL/Model/Model.cs | 163 ++++++++++- 7 files changed, 433 insertions(+), 115 deletions(-) create mode 100644 DataBase/版本日志/SGGLDB_V2025-05-14-001_bwj.sql create mode 100644 SGGL/FineUIPro.Web/File/Excel/DataOut/排产计划导出模板.xlsx diff --git a/DataBase/版本日志/SGGLDB_V2025-05-14-001_bwj.sql b/DataBase/版本日志/SGGLDB_V2025-05-14-001_bwj.sql new file mode 100644 index 00000000..87bbe5db --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2025-05-14-001_bwj.sql @@ -0,0 +1,57 @@ + +CREATE VIEW [dbo].[View_HJGL_ProductionSchedulingPlanStatistics] +as +/************Ųƻͳ**********/ +SELECT distinct unitWork.UnitWorkId, +unitWork.UnitWorkCode, +unitWork.UnitWorkName, +unitWork.ProjectId, +pipeline.FlowingSection, +(case p.SteelType when '1' then '̼' when '2' then '' when '3' then '' when '4' then 'ͺϽ' when '5' then 'Ͻ' when '6' then 'ѺϽ' when '7' then '' end) as Material, +'<100' as Caliber, +isnull(weldJoint.Dia,0) as Dia +FROM WBS_UnitWork AS unitWork +LEFT JOIN (select FlowingSection,UnitWorkId from HJGL_Pipeline where PipeArea='1') as pipeline on pipeline.UnitWorkId = unitWork.UnitWorkId + +LEFT JOIN (select distinct Base_Material.SteelType,UnitWorkId from HJGL_WeldJoint + left join HJGL_Pipeline on HJGL_Pipeline.PipelineId = HJGL_WeldJoint.PipelineId + left join Base_Material on Base_Material.MaterialId = HJGL_WeldJoint.Material1Id + where PipeArea='1' and HJGL_WeldJoint.JointAttribute='Ԥƿ') as p on p.UnitWorkId = unitWork.UnitWorkId +-- +LEFT JOIN (select sum(Dia) as Dia,HJGL_Pipeline.UnitWorkId,HJGL_Pipeline.FlowingSection,Base_Material.SteelType,HJGL_WeldJoint.DNDia from HJGL_WeldJoint + left join HJGL_Pipeline on HJGL_Pipeline.PipelineId = HJGL_WeldJoint.PipelineId + left join Base_Material on Base_Material.MaterialId = HJGL_WeldJoint.Material1Id + where HJGL_Pipeline.PipeArea='1' and HJGL_WeldJoint.JointAttribute='Ԥƿ' + and cast(SUBSTRING(HJGL_WeldJoint.DNDia,CHARINDEX('N',HJGL_WeldJoint.DNDia)+1,len(HJGL_WeldJoint.DNDia)-charindex('N',HJGL_WeldJoint.DNDia)) as int)<100 + group by HJGL_Pipeline.UnitWorkId,HJGL_Pipeline.FlowingSection,Base_Material.SteelType,HJGL_WeldJoint.DNDia) as weldJoint on weldJoint.UnitWorkId =unitWork.UnitWorkId + and weldJoint.FlowingSection = pipeline.FlowingSection + +union + +SELECT distinct unitWork.UnitWorkId, +unitWork.UnitWorkCode, +unitWork.UnitWorkName, +unitWork.ProjectId, +pipeline.FlowingSection, +(case p.SteelType when '1' then '̼' when '2' then '' when '3' then '' when '4' then 'ͺϽ' when '5' then 'Ͻ' when '6' then 'ѺϽ' when '7' then '' end) as Material, +'100' as Caliber, +isnull(weldJoint.Dia,0) as Dia +FROM WBS_UnitWork AS unitWork +LEFT JOIN (select FlowingSection,UnitWorkId from HJGL_Pipeline where PipeArea='1') as pipeline on pipeline.UnitWorkId = unitWork.UnitWorkId + +LEFT JOIN (select distinct Base_Material.SteelType,UnitWorkId from HJGL_WeldJoint + left join HJGL_Pipeline on HJGL_Pipeline.PipelineId = HJGL_WeldJoint.PipelineId + left join Base_Material on Base_Material.MaterialId = HJGL_WeldJoint.Material1Id + where PipeArea='1' and HJGL_WeldJoint.JointAttribute='Ԥƿ') as p on p.UnitWorkId = unitWork.UnitWorkId + +LEFT JOIN (select sum(Dia) as Dia,HJGL_Pipeline.UnitWorkId,HJGL_Pipeline.FlowingSection,Base_Material.SteelType,HJGL_WeldJoint.DNDia from HJGL_WeldJoint + left join HJGL_Pipeline on HJGL_Pipeline.PipelineId = HJGL_WeldJoint.PipelineId + left join Base_Material on Base_Material.MaterialId = HJGL_WeldJoint.Material1Id + where HJGL_Pipeline.PipeArea='1' and HJGL_WeldJoint.JointAttribute='Ԥƿ' + and cast(SUBSTRING(HJGL_WeldJoint.DNDia,CHARINDEX('N',HJGL_WeldJoint.DNDia)+1,len(HJGL_WeldJoint.DNDia)-charindex('N',HJGL_WeldJoint.DNDia)) as int)>=100 + group by HJGL_Pipeline.UnitWorkId,HJGL_Pipeline.FlowingSection,Base_Material.SteelType,HJGL_WeldJoint.DNDia) as weldJoint on weldJoint.UnitWorkId =unitWork.UnitWorkId + and weldJoint.FlowingSection = pipeline.FlowingSection + +GO + + diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index 5a9981a1..00cd10f3 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -4801,6 +4801,11 @@ namespace BLL /// public const string Pipeline_ComponentPath = "File\\Excel\\DataIn\\组件管理二维码信息导入.xlsx"; + /// + /// 排产计划导出模板 + /// + public const string HJGL_ProductionSchedulingPlanPath = "File\\Excel\\DataOut\\排产计划导出模板.xlsx"; + #region 焊接报表 /// diff --git a/SGGL/BLL/HJGL/PreDesign/ProductionSchedulingPlanService.cs b/SGGL/BLL/HJGL/PreDesign/ProductionSchedulingPlanService.cs index 878660bf..ae787f4c 100644 --- a/SGGL/BLL/HJGL/PreDesign/ProductionSchedulingPlanService.cs +++ b/SGGL/BLL/HJGL/PreDesign/ProductionSchedulingPlanService.cs @@ -23,22 +23,17 @@ namespace BLL return Funs.DB.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProductionSchedulingPlanId == productionSchedulingPlanId); } - /// - /// 根据管线Id获取排产计划 - /// - /// - /// - /// - public static Model.HJGL_ProductionSchedulingPlan GetProductionSchedulingPlanByPipelineId(string projectId, string pipelineId) + + public static Model.HJGL_ProductionSchedulingPlan GetProductionSchedulingPlan(string loginProjectId, string flowingSection, string unitWorkName, string material, string caliber) { - return Funs.DB.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProjectId == projectId && e.PipelineId == pipelineId); + return Funs.DB.HJGL_ProductionSchedulingPlan.FirstOrDefault(e => e.ProjectId == loginProjectId && e.FlowNum == flowingSection && e.MainItemName == unitWorkName && e.Caliber == caliber); } - /// - /// 增加排产计划 - /// - /// - public static void AddProductionSchedulingPlan(Model.HJGL_ProductionSchedulingPlan plan) + /// + /// 增加排产计划 + /// + /// + public static void AddProductionSchedulingPlan(Model.HJGL_ProductionSchedulingPlan plan) { SGGLDB db = Funs.DB; Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan(); @@ -83,7 +78,7 @@ namespace BLL newPlan.PlanStartDate = plan.PlanStartDate; newPlan.PlanEndDate = plan.PlanEndDate; newPlan.Days = plan.Days; - newPlan.AvgDailyWorkload = plan.Days; + newPlan.AvgDailyWorkload = plan.AvgDailyWorkload; try { db.SubmitChanges(System.Data.Linq.ConflictMode.ContinueOnConflict); @@ -120,5 +115,6 @@ namespace BLL db.SubmitChanges(); } } + } } diff --git a/SGGL/FineUIPro.Web/File/Excel/DataOut/排产计划导出模板.xlsx b/SGGL/FineUIPro.Web/File/Excel/DataOut/排产计划导出模板.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..af9e36437101b17c292ac65a73fb6f30e5fc47e5 GIT binary patch literal 9565 zcmeHNby$>Jw;#G==Z>{yJDZ;_y0T2Pm004j*kT4Hv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uqsWDH-lsF1hw9aazcmU*;tFVj-`qxDPb3zI$zz626cnFLyXKYf)yzQoP!Id+q+ZlbYoB!%PM3&y@aG>i>NpLi#h;aPWbY89`>bSL9 zQSg?0(~BaF3&u*2VdVk+Xo8XMDnuDX`>Mvg6iYh(!+9&B6;5iIp$H5!OB0cw~$tq6%Ond2P}I+Qq7wA|s)*VNPP%A-8fwidSAecd?-GM}WcT2zg-CuNR>gEf`xLQXL5gA!iE3atKX$ zfqyP-&hyrP_7Rya>^jGn+bV6PwyQK{-Gtx&$hWQtSue7(utJ6<$FNsS z28l8txTjMGjNizPnq?R?4-XbfMx9sfe8hsL$(0yd0fZOB>p<74tg7RpR#0E5MT{1u z`!f4wTINBWI*{aT)HpNIT3lJmN4Ce7hSKQAcP-r;`BzC{Eze)gk588^Ovesj2|AL3 z1e_hwA7bLfpd=x(cJx_%fDMEd-i50{CwC631i_T0PHi~2D7~8Zx#QdCGtpLj_5u5> zNQf;`x&U^yYOg5}6i)2K`nAi-fVt+m|H3zQJBrKts{uCwk{ple^SMcQv1`NcsJ{!b z$2(wSRw#=xp)AJzmBp5x?j9~q{}B1#GzI{2;)i|&+3thqcaon)24bh3h@HAeo>EcZ zy=_S1n?qIBfOtIYxSK;yTW)?P4dpUSy5EE&V*fV=GiM^R6o+H9!3jcQfH&2E92^UOf>- z9=pgp7?cTn^kxXCkKG2(!slx&PDo z^(Z=Yb&^n0nS`!Ny3PgjNOsJ-st9(zn$G=hZ_Xm-c*n0aHl5M$ahgrK8&{tbh74>} zT@E0otDYWxz9#=S%V1zxp#}WkKjHCnQUCn(o98{$6#okF*Y@xBhE1 g{?*!-@)zr$u~|(K0ZQT@btVjeEz}Pdseg?A3pjJkt^fc4 literal 0 HcmV?d00001 diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx b/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx index 37679631..c6f83703 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx @@ -53,7 +53,7 @@ @@ -103,45 +103,41 @@ DataField="PriorityTotalDyne" SortField="PriorityTotalDyne" FieldType="Float" HeaderTextAlign="Center" TextAlign="Left" Width="120px"> - + - + - + - + - + - <%-- - - - - --%> + + + @@ -166,6 +162,10 @@ function reloadGrid() { __doPostBack(null, 'reloadGrid'); } + + function onGridDataLoad(event) { + this.mergeColumns(['FlowNum', 'MainItemName', 'Material', 'TotalDyne']); + } diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx.cs index 45ea38ee..54a1c395 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/ProductionSchedulingPlan.aspx.cs @@ -26,17 +26,6 @@ namespace FineUIPro.Web.HJGL.PreDesign { this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString(); this.InitTreeMenu();//加载树 - //HJGL_PipelineComponentService.InitMainItemDownList(drpState, true); - //HJGL_PipelineComponentService.InitMainItemDownProductionStateList(drpProductionState, true); - - //var pipeline = (from x in Funs.DB.HJGL_Pipeline - // where x.ProjectId == this.CurrUser.LoginProjectId - // select x.FlowingSection).Distinct().ToList(); - //this.drpFlowingSection.DataTextField = "Value"; - //this.drpFlowingSection.DataValueField = "Value"; - //this.drpFlowingSection.DataSource = pipeline; - //this.drpFlowingSection.DataBind(); - //Funs.FineUIPleaseSelect(drpFlowingSection); } } @@ -123,11 +112,12 @@ namespace FineUIPro.Web.HJGL.PreDesign { foreach (var q in unitWork2) { - int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == "1" && x.PipelineCode.Contains(txtPipelineCode.Text.Trim()) select x).Count(); + int a = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && x.PipeArea == "1" && x.PipelineCode.Contains(txtPipelineCode.Text.Trim()) select x.FlowingSection).Distinct().Count(); var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); TreeNode tn2 = new TreeNode(); tn2.NodeID = q.UnitWorkId; - tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线"; + //tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线"; + tn2.Text = q.UnitWorkName; if (q.UnitWorkId == this.hdUnitWorkId.Text) { tn2.Expanded = true; @@ -155,42 +145,42 @@ namespace FineUIPro.Web.HJGL.PreDesign private void BindNodes(TreeNode node) { - List pipeline = new List(); - var pipelines = from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.PipeArea == "1" select x; - pipeline = (from x in pipelines - where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == node.NodeID && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) - orderby x.PipelineCode - select x).ToList(); - int pageindex = int.Parse(node.CommandName.Split('|')[0]); - int pageCount = int.Parse(node.CommandName.Split('|')[1]); - if (pageindex <= pageCount) + List flowingSection = new List(); + //List pipeline = new List(); + var list = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.PipeArea == "1" && x.UnitWorkId == node.NodeID && x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) select x.FlowingSection).ToList(); + flowingSection = list.Where(x => !string.IsNullOrWhiteSpace(x) == true).Distinct().OrderBy(x => x).ToList(); + //int pageindex = int.Parse(node.CommandName.Split('|')[0]); + //int pageCount = int.Parse(node.CommandName.Split('|')[1]); + //if (pageindex <= pageCount) + //{ + // flowingSection = flowingSection.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList(); + foreach (var item in flowingSection) { - pipeline = pipeline.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList(); - foreach (var item in pipeline) - { - var comCount = (from x in Funs.DB.HJGL_Pipeline_Component where x.PipelineId == item.PipelineId select x).Count(); - TreeNode newNode = new TreeNode(); - newNode.Text = item.PipelineCode + "【" + comCount.ToString() + " " + "组件" + "】"; - newNode.ToolTip = "管线号【组件数】"; - newNode.CommandName = "管线"; - newNode.NodeID = item.PipelineId; - newNode.EnableClickEvent = true; - node.Nodes.Add(newNode); - } - if (pageindex < pageCount) - { - TreeNode newNode = new TreeNode(); - newNode.Text = "加载"; - newNode.NodeID = SQLHelper.GetNewID(); - newNode.CommandName = "加载"; - newNode.Icon = Icon.ArrowDown; - newNode.EnableClickEvent = true; - node.Nodes.Add(newNode); - } + //var comCount = (from x in Funs.DB.HJGL_Pipeline_Component where x.PipelineId == item.PipelineId select x).Count(); + TreeNode newNode = new TreeNode(); + //newNode.Text = item.PipelineCode + "【" + comCount.ToString() + " " + "组件" + "】"; + + newNode.Text = item; + newNode.ToolTip = "流水段"; + newNode.CommandName = "流水段"; + newNode.NodeID = SQLHelper.GetNewID(); + newNode.EnableClickEvent = true; + node.Nodes.Add(newNode); } - - + // if (pageindex < pageCount) + // { + // TreeNode newNode = new TreeNode(); + // newNode.Text = "加载"; + // newNode.NodeID = "加载"; + // //newNode.NodeID = SQLHelper.GetNewID(); + // newNode.CommandName = "加载"; + // newNode.Icon = Icon.ArrowDown; + // newNode.EnableClickEvent = true; + // node.Nodes.Add(newNode); + // } + //} } + #endregion protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e) { @@ -209,13 +199,9 @@ namespace FineUIPro.Web.HJGL.PreDesign /// protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e) { - if (e.CommandName.Split('|').Length == 2) + if (e.CommandName == "流水段") { - this.hdUnitWorkId.Text = this.tvControlItem.SelectedNodeID; - } - else if (e.CommandName == "管线") - { - Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID); + Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByFlowingSection(this.tvControlItem.SelectedNode.Text); this.hdUnitWorkId.Text = string.Empty; if (pipeline != null) { @@ -223,14 +209,6 @@ namespace FineUIPro.Web.HJGL.PreDesign SaveProductionSchedulingPlan(); } } - else if (e.CommandName == "加载") - { - string CommandName = e.Node.ParentNode.CommandName; - e.Node.ParentNode.CommandName = (int.Parse(CommandName.Split('|')[0]) + 1) + "|" + int.Parse(CommandName.Split('|')[1]); - TreeNode treeNode = e.Node.ParentNode; - treeNode.Nodes.Remove(e.Node); - BindNodes(e.Node.ParentNode); - } this.BindGrid(); } @@ -242,27 +220,24 @@ namespace FineUIPro.Web.HJGL.PreDesign { if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) { - var schedulingPlan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlanByPipelineId(this.CurrUser.LoginProjectId, this.tvControlItem.SelectedNodeID); - if (schedulingPlan == null) + List lists = (from x in Funs.DB.View_HJGL_ProductionSchedulingPlanStatistics.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.FlowingSection == this.tvControlItem.SelectedNode.Text) select x).ToList(); + foreach (var item in lists) { - Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan(); - newPlan.ProductionSchedulingPlanId = SQLHelper.GetNewID(typeof(Model.HJGL_ProductionSchedulingPlan)); - newPlan.ProjectId = this.CurrUser.LoginProjectId; - newPlan.PipelineId = this.tvControlItem.SelectedNodeID; - var pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID); - if (pipeline!=null) + var plan = BLL.ProductionSchedulingPlanService.GetProductionSchedulingPlan(this.CurrUser.LoginProjectId, item.FlowingSection, item.UnitWorkName, item.Material, item.Caliber); + if (plan == null) { - newPlan.FlowNum = pipeline.FlowingSection; - if (!string.IsNullOrEmpty(pipeline.UnitWorkId)) - { - newPlan.MainItemName = BLL.UnitWorkService.getUnitWorkByUnitWorkId(pipeline.UnitWorkId).UnitWorkName; - } - if (!string.IsNullOrEmpty(pipeline.PipingClassId)) - { - newPlan.Material = BLL.Base_PipingClassService.GetPipingClassByPipingClassId(pipeline.PipingClassId).SteelType; - } + Model.HJGL_ProductionSchedulingPlan newPlan = new HJGL_ProductionSchedulingPlan(); + newPlan.ProductionSchedulingPlanId = SQLHelper.GetNewID(typeof(Model.HJGL_ProductionSchedulingPlan)); + newPlan.ProjectId = this.CurrUser.LoginProjectId; + //newPlan.PipelineId = this.tvControlItem.SelectedNodeID; + newPlan.FlowNum = item.FlowingSection; + newPlan.MainItemName = item.UnitWorkName; + newPlan.Material = item.Material; + newPlan.Caliber = item.Caliber; + newPlan.Dain = item.Dia; + newPlan.TotalDyne = lists.Sum(x => x.Dia); + BLL.ProductionSchedulingPlanService.AddProductionSchedulingPlan(newPlan); } - BLL.ProductionSchedulingPlanService.AddProductionSchedulingPlan(newPlan); } } } @@ -289,23 +264,21 @@ namespace FineUIPro.Web.HJGL.PreDesign p.PlanStartDate, p.PlanEndDate, p.Days, - p.AvgDailyWorkload, - pipeline.UnitWorkId + p.AvgDailyWorkload FROM HJGL_ProductionSchedulingPlan p - left join HJGL_Pipeline as pipeline on pipeline.PipelineId = p.PipelineId WHERE 1=1 "; List listStr = new List(); if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2) { - strSql += " and pipeline.UnitWorkId =@UnitWorkId"; - listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNodeID)); + strSql += " and p.MainItemName =@UnitWorkId"; + listStr.Add(new SqlParameter("@UnitWorkId", this.tvControlItem.SelectedNode.Text)); } - else if (tvControlItem.SelectedNode.CommandName == "管线") + else if (tvControlItem.SelectedNode.CommandName == "流水段") { - strSql += " and p.PipelineId = @PipelineId "; - listStr.Add(new SqlParameter("@PipelineId", this.tvControlItem.SelectedNodeID)); + strSql += " and p.FlowNum = @FlowNum "; + listStr.Add(new SqlParameter("@FlowNum", this.tvControlItem.SelectedNode.Text)); } SqlParameter[] parameter = listStr.ToArray(); @@ -419,8 +392,134 @@ namespace FineUIPro.Web.HJGL.PreDesign #region 导出 protected void btnOut_Click(object sender, EventArgs e) { - + string rootPath = Server.MapPath("~/"); + string initTemplatePath = Const.HJGL_ProductionSchedulingPlanPath; + string uploadfilepath = string.Empty; + string newUrl = string.Empty; + uploadfilepath = rootPath + initTemplatePath; + var lists = (from x in Funs.DB.HJGL_ProductionSchedulingPlan + where x.ProjectId == this.CurrUser.LoginProjectId + select x); + + if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2) + { + lists = lists.Where(x => x.MainItemName == this.tvControlItem.SelectedNode.Text); + } + else if (tvControlItem.SelectedNode.CommandName == "流水段") + { + lists = lists.Where(x => x.FlowNum == this.tvControlItem.SelectedNode.Text); + } + + if (lists != null) + { + newUrl = uploadfilepath.Replace("排产计划导出模板", "排产计划(" + DateTime.Now.ToString("yyyyMMdd") + ")"); + if (File.Exists(newUrl)) + { + File.Delete(newUrl); + } + File.Copy(uploadfilepath, newUrl); + // 第一步:读取文件流 + NPOI.SS.UserModel.IWorkbook workbook; + using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read)) + { + workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream); + //workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream); + } + // 创建单元格样式 + NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle(); + cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin; + cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin; + cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin; + cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin; + cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center; + cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center; + cellStyle.WrapText = true;//自动换行 + var font = workbook.CreateFont(); + font.FontHeightInPoints = 11; + cellStyle.SetFont(font); + // 第二步:创建新数据行 + NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0); + NPOI.SS.UserModel.IRow row = sheet.GetRow(0); + NPOI.SS.UserModel.ICell cell; + int i = 1; + foreach (var item in lists) + { + // 第二步:创建新数据行 + row = sheet.CreateRow(i); + // 添加数据 + cell = row.CreateCell(0); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.FlowNum);//流水段号 + + cell = row.CreateCell(1); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.MainItemName);//主项名称 + + cell = row.CreateCell(2); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.Material);//材质 + + cell = row.CreateCell(3); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.Caliber);//口径 + + cell = row.CreateCell(4); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.Dain.HasValue ? item.Dain.ToString() : "");//达因数 + + cell = row.CreateCell(5); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.TotalDyne.HasValue?item.TotalDyne.ToString():"");//总达因数 + + cell = row.CreateCell(6); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.TotalPriority);//总优先级 + + cell = row.CreateCell(7); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.PriorityTotalDyne.HasValue ? item.PriorityTotalDyne.ToString() : "");//优先级总达因 + + cell = row.CreateCell(8); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.PlanStartDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.PlanStartDate) : "");//计划开始时间 + + cell = row.CreateCell(9); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.PlanEndDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.PlanEndDate) : "");//计划结束时间 + + cell = row.CreateCell(10); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.Days.HasValue?item.Days.ToString():"");//天数 + + cell = row.CreateCell(11); + cell.CellStyle = cellStyle; + cell.SetCellValue(item.AvgDailyWorkload.HasValue ? item.AvgDailyWorkload.ToString():"");//平均每天工作量 + + i++; + } + // 第三步:写入文件流 + using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write)) + { + workbook.Write(stream); + workbook.Close(); + } + string fileName = Path.GetFileName(newUrl); + FileInfo info = new FileInfo(newUrl); + long fileSize = info.Length; + Response.Clear(); + Response.ContentType = "application/x-zip-compressed"; + Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); + Response.AddHeader("Content-Length", fileSize.ToString()); + Response.TransmitFile(newUrl, 0, fileSize); + Response.Flush(); + Response.Close(); + File.Delete(newUrl); + } + else + { + Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning); + } } #endregion } diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 2a5f02a6..8ac734ad 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -6857,6 +6857,14 @@ namespace Model } } + public System.Data.Linq.Table View_HJGL_ProductionSchedulingPlanStatistics + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table View_HJGL_WeldingTask { get @@ -100308,7 +100316,7 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TotalPriority", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TotalPriority", DbType="NVarChar(50)")] public string TotalPriority { get @@ -286333,6 +286341,159 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_HJGL_ProductionSchedulingPlanStatistics")] + public partial class View_HJGL_ProductionSchedulingPlanStatistics + { + + private string _UnitWorkId; + + private string _UnitWorkCode; + + private string _UnitWorkName; + + private string _ProjectId; + + private string _FlowingSection; + + private string _Material; + + private string _Caliber; + + private decimal _Dia; + + public View_HJGL_ProductionSchedulingPlanStatistics() + { + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorkId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)] + public string UnitWorkId + { + get + { + return this._UnitWorkId; + } + set + { + if ((this._UnitWorkId != value)) + { + this._UnitWorkId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorkCode", DbType="NVarChar(10)")] + public string UnitWorkCode + { + get + { + return this._UnitWorkCode; + } + set + { + if ((this._UnitWorkCode != value)) + { + this._UnitWorkCode = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorkName", DbType="NVarChar(30)")] + public string UnitWorkName + { + get + { + return this._UnitWorkName; + } + set + { + if ((this._UnitWorkName != value)) + { + this._UnitWorkName = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")] + public string ProjectId + { + get + { + return this._ProjectId; + } + set + { + if ((this._ProjectId != value)) + { + this._ProjectId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FlowingSection", DbType="NVarChar(200)")] + public string FlowingSection + { + get + { + return this._FlowingSection; + } + set + { + if ((this._FlowingSection != value)) + { + this._FlowingSection = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Material", DbType="VarChar(8)")] + public string Material + { + get + { + return this._Material; + } + set + { + if ((this._Material != value)) + { + this._Material = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Caliber", DbType="VarChar(5) NOT NULL", CanBeNull=false)] + public string Caliber + { + get + { + return this._Caliber; + } + set + { + if ((this._Caliber != value)) + { + this._Caliber = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Dia", DbType="Decimal(38,3) NOT NULL")] + public decimal Dia + { + get + { + return this._Dia; + } + set + { + if ((this._Dia != value)) + { + this._Dia = value; + } + } + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_HJGL_WeldingTask")] public partial class View_HJGL_WeldingTask {