From 11357590c995c26ba033832a32746d61ece6f6eb Mon Sep 17 00:00:00 2001 From: fly-l <1420031550@qq.com> Date: Wed, 8 Nov 2023 17:26:59 +0800 Subject: [PATCH 1/2] 2023-11-08 --- DataBase/版本日志/SGGLDB_V2023-11-08.sql | 61 ++++++++ .../WeldingManage/PipelineComponentService.cs | 139 +++++++++++++++++- .../PhtglContracttrackService .cs | 18 ++- .../PhtglContracttrackprogressService.cs | 24 ++- SGGL/BLL/Person/Person_PersonsService.cs | 2 +- .../File/Fastreport/组件打印.frx | 22 +-- .../HJGL/PreDesign/PrePipeline.aspx | 1 + .../HJGL/PreDesign/PrePipeline.aspx.cs | 93 ++---------- .../PreDesign/PrePipelineBatchEdit.aspx.cs | 3 +- .../HJGL/WeldingManage/WeldTask.aspx | 8 +- .../HJGL/WeldingManage/WeldTask.aspx.cs | 51 +++++++ .../WeldingManage/WeldTask.aspx.designer.cs | 18 +++ .../ContractTrackComparison.aspx | 10 +- .../ContractTrackComparison.aspx.cs | 3 +- .../ContractCompile/ContractTrackList.aspx | 6 +- .../ContractTrackProgressDetectionGrid.aspx | 4 +- ...ContractTrackProgressDetectionGrid.aspx.cs | 17 ++- .../PHTGL/ContractCompile/ContractWBS.aspx | 2 +- SGGL/Model/Model.cs | 42 ++++++ 19 files changed, 389 insertions(+), 135 deletions(-) create mode 100644 DataBase/版本日志/SGGLDB_V2023-11-08.sql diff --git a/DataBase/版本日志/SGGLDB_V2023-11-08.sql b/DataBase/版本日志/SGGLDB_V2023-11-08.sql new file mode 100644 index 00000000..1c74fcf8 --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2023-11-08.sql @@ -0,0 +1,61 @@ + +alter table dbo.HJGL_Pipeline_Component + add IsPrint BIT +go + +exec sp_addextendedproperty 'MS_Description', N'Ƿӡ', 'SCHEMA', 'dbo', 'TABLE', 'HJGL_Pipeline_Component', + 'COLUMN', 'IsPrint' +go + + alter view dbo.View_HJGL_WeldingTask as + SELECT T.WeldTaskId, + T.WeldJointId, + T.CoverWelderId, + T.BackingWelderId, + cov.WelderCode AS CoverWelderCode, + back.WelderCode AS BackingWelderCode, + case when jot.JointAttribute is not null then jot.JointAttribute else T.JointAttribute end as JointAttribute, + T.WeldingMode, + T.ProjectId, + T.UnitWorkId, + T.UnitId, + T.TaskDate, + T.Tabler, + T.TableDate, + jot.WeldJointCode, + jot.Dia, + jot.DNDia, + jot.Thickness, + jot.Size, + jot.WeldingLocationId, + CASE WHEN jot.WeldingDailyId IS NULL THEN '' ELSE '' END AS IsWelding, + P.PipelineCode, + p.PipelineId, + B.WeldTypeCode, + M.WeldingMethodCode, + L.WeldingLocationCode, + t.CanWelderCode, + t.CanWelderId, + rod.ConsumablesName AS WeldingRodCode, + T.CanWeldingRodName, + T.CanWeldingWireName, + wire.ConsumablesName AS WeldingWireCode, + jot.WeldingDailyId, + p.PipeArea, + (case + when charindex('/', jot.WeldJointCode) > 0 + then RIGHT(jot.WeldJointCode, CHARINDEX('/', REVERSE(jot.WeldJointCode)) - 1) + else jot.WeldJointCode end) as WeldJointNum + from HJGL_WeldTask T + left join HJGL_WeldJoint jot on T.WeldJointId = jot.WeldJointId + LEFT JOIN dbo.SitePerson_Person cov ON cov.PersonId = t.CoverWelderId and cov.ProjectId = t.ProjectId + LEFT JOIN dbo.SitePerson_Person back ON back.PersonId = t.BackingWelderId and back.ProjectId = t.ProjectId + LEFT join HJGL_Pipeline P on jot.PipelineId = P.PipelineId + left join Base_WeldType B on jot.WeldTypeId = B.WeldTypeId + LEFT join Base_WeldingMethod M on jot.WeldingMethodId = M.WeldingMethodId + left join Base_WeldingLocation L on jot.WeldingLocationId = L.WeldingLocationId + LEFT JOIN Base_Consumables AS wire ON wire.ConsumablesId = jot.WeldingWire + LEFT JOIN Base_Consumables AS rod ON rod.ConsumablesId = jot.WeldingRod +go + + diff --git a/SGGL/BLL/HJGL/WeldingManage/PipelineComponentService.cs b/SGGL/BLL/HJGL/WeldingManage/PipelineComponentService.cs index c0c7e3d1..615d0498 100644 --- a/SGGL/BLL/HJGL/WeldingManage/PipelineComponentService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/PipelineComponentService.cs @@ -1,8 +1,11 @@ using System; +using System.Collections; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Web.UI.WebControls; using Model; +using NPOI.SS.Formula.Functions; namespace BLL { @@ -12,16 +15,21 @@ namespace BLL /// 未验收 /// public static int state_0 = 0; + /// /// 已验收 /// public static int state_1 = 1; + /// /// 已装箱 /// public static int state_2 = 2; - + /// + /// 获取状态名称 + /// + /// public static ListItem[] GetState() { ListItem[] list = new ListItem[3]; @@ -30,6 +38,10 @@ namespace BLL list[2] = new ListItem("已出库", state_2.ToString()); return list; } + /// + /// 生产状态 + /// + /// public static ListItem[] GetProductionState() { ListItem[] list = new ListItem[3]; @@ -61,6 +73,81 @@ namespace BLL { return Funs.DB.HJGL_Pipeline_Component.FirstOrDefault(e => e.PipeLineMatId == pipeLineMatId); } + + /// + /// 获取打印实体 + /// + /// + /// + /// + /// + public static IEnumerable GetPrintModelByPipelineComponentIds( + string[] PipelineComponentId, string[] PipelineId, bool IsCheckPrint) + { + var db = Funs.DB; + var query = + from com in db.HJGL_Pipeline_Component + + join mat in db.HJGL_PipeLineMat on com.PipeLineMatId equals mat.PipeLineMatId into matJoin + + from mat in matJoin.DefaultIfEmpty() + join pipe in db.HJGL_Pipeline on com.PipelineId equals pipe.PipelineId into pipeJoin + + from pipe in pipeJoin.DefaultIfEmpty() + join punit in db.Base_Unit on com.PreUnit equals punit.UnitId into punitJoin + + from punit in punitJoin.DefaultIfEmpty() + join aunit in db.Base_Unit on com.AssembleUnit equals aunit.UnitId into aunitJoin + + from aunit in aunitJoin.DefaultIfEmpty() + join unitwork in db.WBS_UnitWork on pipe.UnitWorkId equals unitwork.UnitWorkId into unitworkJoin + + from unitwork in unitworkJoin.DefaultIfEmpty() + join mater in db.Base_Material on pipe.MaterialId equals mater.MaterialId into materJoin + + from mater in materJoin.DefaultIfEmpty() + where com.QRCode != "" + orderby com.PipelineComponentCode,com.PipelineId + + select new PipelineComponentPrintDto + { + PipelineComponentId = com.PipelineComponentId, + PipelineComponentCode = com.PipelineComponentCode, + BoxNumber = com.BoxNumber, + UnitWorkName = unitwork.UnitWorkName, + PipelineId = com.PipelineId, + PreUnit = punit.UnitName, + AssembleUnit = aunit.UnitName, + PrefabricatedComponents = mat.PrefabricatedComponents, + QRCode = com.QRCode, + State = com.State, + PlanStartDate = string.Format("yyyy-MM-dd", pipe.PlanStartDate), + PipelineCode = pipe.PipelineCode, + FlowingSection = pipe.FlowingSection, + QRCode2 = "PrePipeline$" + com.PipelineComponentId, + MaterialCode = mater.MaterialCode, + IsPrint = com.IsPrint + + }; + var result = query.ToList(); + if (PipelineComponentId!=null &&PipelineComponentId.Length > 0) + { + result = result.Where(x => PipelineComponentId.Contains(x.PipelineComponentId.ToString())).ToList(); + } + if (PipelineId != null && PipelineId.Length > 0) + { + result = result.Where(x => PipelineId.Contains(x.PipelineId.ToString())).ToList(); + } + + if (IsCheckPrint != null & IsCheckPrint ==true) + { + result = result.Where(x => x.IsPrint==false||x.IsPrint==null).ToList(); + } + return result; + } + + + /// /// 判断管线组件Code是否存在 /// @@ -119,6 +206,7 @@ namespace BLL model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')).Replace("\"", ""); model.State = state_0; model.ProductionState = 0; + model.IsPrint = false; AddPipelineComponent(model); } @@ -133,6 +221,7 @@ namespace BLL { Model.SGGLDB db = Funs.DB; Model.HJGL_Pipeline_Component newPipeline = new Model.HJGL_Pipeline_Component(); + pipeline.IsPrint ??= false; newPipeline.PipelineComponentId = pipeline.PipelineComponentId; newPipeline.PipelineId = pipeline.PipelineId; newPipeline.PreUnit = pipeline.PreUnit; @@ -150,6 +239,7 @@ namespace BLL newPipeline.ReceiveMan= pipeline.ReceiveMan; newPipeline.ReceiveDate= pipeline.ReceiveDate; newPipeline.ProductionState= pipeline.ProductionState; + newPipeline.IsPrint= pipeline.IsPrint; db.HJGL_Pipeline_Component.InsertOnSubmit(newPipeline); db.SubmitChanges(); } @@ -180,10 +270,15 @@ namespace BLL newPipeline.ReceiveMan = pipeline.ReceiveMan; newPipeline.ReceiveDate = pipeline.ReceiveDate; newPipeline.ProductionState = pipeline.ProductionState; - + newPipeline.IsPrint=pipeline.IsPrint; db.SubmitChanges(); } } + /// + /// 修改出库状态 + /// + /// + /// public static void UpdateOutState(string pipelineComponentId,string BoxNumber) { var q=GetPipelineComponentById(pipelineComponentId); @@ -196,6 +291,24 @@ namespace BLL } } + /// + /// 修改打印状态 + /// + /// + public static void UpdateIsPrint(string[] PipelineComponentId) + { + var componentsToUpdate = Funs.DB.HJGL_Pipeline_Component + + .Where(c => PipelineComponentId.Contains(c.PipelineComponentId)); + + foreach (var component in componentsToUpdate) + { + component.IsPrint = true; + } + + Funs.DB.SubmitChanges(); + } + /// /// 修改生产状态 /// @@ -345,4 +458,26 @@ namespace BLL } } } + + public class PipelineComponentPrintDto + + { + public string PipelineComponentId { get; set; } + public string PipelineComponentCode { get; set; } + public string BoxNumber { get; set; } + public string UnitWorkName { get; set; } + public string PipelineId { get; set; } + public string PreUnit { get; set; } + public string AssembleUnit { get; set; } + public string PrefabricatedComponents { get; set; } + public string QRCode { get; set; } + public int? State { get; set; } + public string PlanStartDate { get; set; } + public string PipelineCode { get; set; } + public string FlowingSection { get; set; } + public string QRCode2 { get; set; } + public string MaterialCode { get; set; } + public bool? IsPrint { get; set; } + } + } diff --git a/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackService .cs b/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackService .cs index b5bef723..ce936b25 100644 --- a/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackService .cs +++ b/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackService .cs @@ -168,7 +168,6 @@ namespace BLL return Funs.DB.PHTGL_ContractTrack.FirstOrDefault(x => x.Id == id); } - public static void AddPHTGL_ContractTrack(PHTGL_ContractTrack newtable) { var table = new PHTGL_ContractTrack @@ -209,7 +208,14 @@ namespace BLL PhtglContracttrackprogressService.CreateTemplateByContractTrackId(newtable.Id); } - + + public static void AddBulkPHTGL_ContractTrack(List list) + { + Model.SGGLDB db = Funs.DB; + db.PHTGL_ContractTrack.InsertAllOnSubmit(list); + db.SubmitChanges(); + } + public static void UpdatePHTGL_ContractTrack(PHTGL_ContractTrack newtable) @@ -352,12 +358,12 @@ namespace BLL { var responeData = new ResponeData(); List rows; + List goingAddList =new List(); var sheetNames = MiniExcel.GetSheetNames(path); foreach (var sheet in sheetNames) ////多sheet导入 { try { - rows = MiniExcel.Query(path, sheetName: sheet,startCell:"A2").ToList(); } catch (Exception ex) @@ -388,16 +394,16 @@ namespace BLL ContractId = contractid, ProjectId = projectid, }; - var resultModel = GetPHTGL_ContractTrackByModle(phtglContractTrack); + var resultModel = GetFirstPHTGL_ContractTrackByModle(phtglContractTrack); item.ContractNum = ContractService.GetContractById(contractid)?.ContractNum; if (!string.IsNullOrEmpty(item.ProjectCode) && !item.ProjectCode.Contains("-")) { item.ProjectCode = item.MainItemCode + "-" + item.ProjectCode; } - if (resultModel.Any()) + if (resultModel!=null) { - item.Id = resultModel[0].Id; + item.Id = resultModel.Id; UpdatePHTGL_ContractTrack(item); } else diff --git a/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackprogressService.cs b/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackprogressService.cs index 5fc442a7..7f9a8c83 100644 --- a/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackprogressService.cs +++ b/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackprogressService.cs @@ -17,8 +17,7 @@ namespace BLL /// public static int Count { get; set; } - public static List GetPHTGL_ContractTrackProgressByModle( - PHTGL_ContractTrackProgress table) + public static IQueryable GetPHTGL_ContractTrackProgressByModle( PHTGL_ContractTrackProgress table) { var q = from x in Funs.DB.PHTGL_ContractTrackProgress where @@ -31,10 +30,23 @@ namespace BLL orderby x.Date select x ; - - return q.ToList(); + return q; + } + public static PHTGL_ContractTrackProgress GetFirstOrDefaultByModle(PHTGL_ContractTrackProgress table) + { + var q = (from x in Funs.DB.PHTGL_ContractTrackProgress + where + (string.IsNullOrEmpty(table.ContractTrackProgressId) || + x.ContractTrackProgressId.Contains(table.ContractTrackProgressId)) && + (string.IsNullOrEmpty(table.ContractTrackId) || + x.ContractTrackId.Contains(table.ContractTrackId)) && + (string.IsNullOrEmpty(table.Date) || + x.Date.Contains(table.Date)) + orderby x.Date + select x).FirstOrDefault() + ; + return q; } - /// /// 获取分页列表 /// @@ -46,7 +58,7 @@ namespace BLL var q = GetPHTGL_ContractTrackProgressByModle(table); Count = q.Count(); if (Count == 0) return null; - q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize).ToList(); + q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize); // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); return from x in q select new diff --git a/SGGL/BLL/Person/Person_PersonsService.cs b/SGGL/BLL/Person/Person_PersonsService.cs index c9d874d1..dda3cd6e 100644 --- a/SGGL/BLL/Person/Person_PersonsService.cs +++ b/SGGL/BLL/Person/Person_PersonsService.cs @@ -246,7 +246,7 @@ namespace BLL var pUnit = Funs.DB.Project_ProjectUnit.FirstOrDefault(e => e.ProjectId == ProjectId && e.UnitId == PersonEntity.UnitId); if (pUnit != null) { - if (pUnit.UnitType == Const.ProjectUnitType_1 ) + if (pUnit.UnitType == Const.ProjectUnitType_1 || pUnit.UnitType == Const.ProjectUnitType_2) { result = true; } diff --git a/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx b/SGGL/FineUIPro.Web/File/Fastreport/组件打印.frx index 9938dabe..7e8e98bb 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,24 +99,8 @@ namespace FastReport } - - - - - - - - - - - - - - - - - - + + diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx index 07f612ac..ae328f8d 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipeline.aspx @@ -131,6 +131,7 @@ + 0) - { - result = result.Where(x => PipelineComponentId.Contains(x.PipelineComponentId)).ToList(); - } + var result = HJGL_PipelineComponentService.GetPrintModelByPipelineComponentIds(PipelineComponentId, null, false); var tb = LINQToDataTable(result); - if (tb != null) + if (tb != null && tb.Rows.Count > 0) { tb.TableName = "Table1"; } + else + { + ShowNotify("请查看组件是否上传二维码!", MessageBoxIcon.Question); + return; + } BLL.FastReportService.AddFastreportTable(tb); string initTemplatePath = ""; string rootPath = Server.MapPath("~/"); @@ -416,40 +382,7 @@ namespace FineUIPro.Web.HJGL.PreDesign { PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); - } - /*string strSql = @" SELECT com.PipelineComponentId,com.PipelineComponentCode,com.BoxNumber,unitwork.UnitWorkName, - com.PipelineId, punit.UnitName AS PreUnit,aunit.UnitName AS AssembleUnit,mat.PrefabricatedComponents, - com.QRCode,com.State,CONVERT(varchar(100), pipe.PlanStartDate, 23) as PlanStartDate,pipe.PipelineCode,pipe.FlowingSection, - ('PrePipeline$'+com.PipelineComponentId )as QRCode2,mater.* - FROM HJGL_Pipeline_Component com - LEFT JOIN HJGL_PipeLineMat mat ON mat.PipeLineMatId=com.PipeLineMatId - LEFT JOIN HJGL_Pipeline pipe ON pipe.PipelineId =com.PipelineId - LEFT JOIN dbo.Base_Unit punit ON punit.UnitId=com.PreUnit - LEFT JOIN dbo.Base_Unit aunit ON aunit.UnitId=com.AssembleUnit - LEFT JOIN dbo.WBS_UnitWork unitwork on pipe.UnitWorkId=unitwork.UnitWorkId - LEFT JOIN dbo.Base_Material AS mater ON mater.MaterialId=pipe.MaterialId - WHERE com.QRCode!=''"; - List listStr = new List { }; - - strSql += " AND com.PipelineId =@PipelineId"; - listStr.Add(new SqlParameter("@PipelineId", PipelineId)); - - SqlParameter[] parameter = listStr.ToArray(); - DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); - if (tb != null) - { - tb.TableName = "Table1"; - } - BLL.FastReportService.AddFastreportTable(tb); - 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))); - - }*/ + } } /// diff --git a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineBatchEdit.aspx.cs b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineBatchEdit.aspx.cs index 21381f54..a9da0fc6 100644 --- a/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineBatchEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/PreDesign/PrePipelineBatchEdit.aspx.cs @@ -73,8 +73,7 @@ namespace FineUIPro.Web.HJGL.PreDesign pipeline.AssembleUnit = this.drpAssembleUnit.SelectedValue; } pipeline.BoxNumber = this.txtBoxNumber.Text.Trim(); - pipeline.PipelineId = hdPipelineId.Text; - + pipeline.PipelineId = hdPipelineId.Text; BLL.HJGL_PipelineComponentService.AddPipelineComponent(pipeline); } } diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx index a6777905..de444054 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx @@ -68,7 +68,8 @@ - + + @@ -214,6 +215,11 @@ EnableMaximize="true" Target="Top" EnableResize="false" runat="server" IsModal="true" Width="1300px" Height="650px" OnClose="Window1_Close"> + + diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs index ef0e5ce6..d0e6bfbb 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs @@ -3,6 +3,7 @@ using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; +using System.IO; using System.Linq; using System.Web.UI.WebControls; @@ -1115,5 +1116,55 @@ namespace FineUIPro.Web.HJGL.WeldingManage this.BindGrid(GetWeldingTaskList); } } + + protected void btnPrint_Click(object sender, EventArgs e) + { + DateTime? taskTime = Funs.GetNewDateTime(tvControlItem.SelectedNodeID.Split('|')[1]); + if (taskTime != null) + { + var pipelines = BLL.WeldTaskService.GetWeldingTaskList(this.CurrUser.LoginProjectId, tvControlItem.SelectedNode.ParentNode.NodeID, Convert.ToDateTime(taskTime)).Select(x=>x.PipelineId).Distinct().ToList(); + + if (pipelines.Any()) + { + BLL.FastReportService.ResetData(); + + var result = HJGL_PipelineComponentService.GetPrintModelByPipelineComponentIds(null, pipelines.ToArray(),true); + var PipelineComponentIds = result.Select(x => x.PipelineComponentId).ToArray(); + var tb = LINQToDataTable(result); + if (tb != null && tb.Rows.Count>0) + { + tb.TableName = "Table1"; + } + else + { + ShowNotify("该管线已打印完成", MessageBoxIcon.Question); + return; + } + BLL.FastReportService.AddFastreportTable(tb); + 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))); + + HJGL_PipelineComponentService.UpdateIsPrint(PipelineComponentIds); + } + + } + else + { + ShowNotify("无关联管线", MessageBoxIcon.Question); + + } + + + } + else + { + ShowNotify("请选择任务单",MessageBoxIcon.Question); + } + } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.designer.cs index ff8f4c3b..7f5b853e 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.designer.cs @@ -176,6 +176,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.Button btnSearch; + /// + /// btnPrint 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnPrint; + /// /// txtTaskDate 控件。 /// @@ -284,6 +293,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.Window Window1; + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window2; + /// /// Menu1 控件。 /// diff --git a/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractTrackComparison.aspx b/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractTrackComparison.aspx index 8d72ddc3..4e492a14 100644 --- a/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractTrackComparison.aspx +++ b/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractTrackComparison.aspx @@ -126,7 +126,7 @@ - @@ -162,13 +162,13 @@ - - - @@ -174,13 +174,13 @@ - - diff --git a/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractTrackProgressDetectionGrid.aspx b/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractTrackProgressDetectionGrid.aspx index e53281df..5571840f 100644 --- a/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractTrackProgressDetectionGrid.aspx +++ b/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractTrackProgressDetectionGrid.aspx @@ -39,9 +39,9 @@ + EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableRowClickEvent="True" > diff --git a/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractTrackProgressDetectionGrid.aspx.cs b/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractTrackProgressDetectionGrid.aspx.cs index d1a0de7d..f9e1f13e 100644 --- a/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractTrackProgressDetectionGrid.aspx.cs +++ b/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractTrackProgressDetectionGrid.aspx.cs @@ -36,10 +36,12 @@ namespace FineUIPro.Web.PHTGL.ContractCompile list[1] = new ListItem("主项名称", "MainItemName"); list[2] = new ListItem("专业工程名称", "MajorName"); list[3] = new ListItem("专业代码", "MajorCode"); - list[4] = new ListItem("分部工程", "SubProject"); - list[5] = new ListItem("分项工程", "SubItemProject"); - list[6] = new ListItem("项目编码", "ProjectCode"); - list[7] = new ListItem("项目名称", "ProjectName"); + //list[4] = new ListItem("分部工程", "SubProject"); + //list[5] = new ListItem("子分部工程", "SubItemProject"); + list[4] = new ListItem("项目编码", "ProjectCode"); + list[5] = new ListItem("项目名称", "ProjectName"); + list[6] = new ListItem("项目特征描述", "ProjectDescription"); + list[7] = new ListItem("计量单位", "UnitOfMeasurement"); foreach (var item in list) { @@ -49,6 +51,7 @@ namespace FineUIPro.Web.PHTGL.ContractCompile bf.HeaderText = item.Text; bf.HeaderTextAlign = TextAlign.Center; bf.TextAlign = TextAlign.Center; + bf.Locked = true; Grid1.Columns.Add(bf); GridTable.Columns.Add(item.Value); } @@ -306,10 +309,12 @@ namespace FineUIPro.Web.PHTGL.ContractCompile row["MainItemName"] = item.MainItemName; row["MajorName"] = item.MajorName; row["MajorCode"] = item.MajorCode; - row["SubProject"] = item.SubProject; - row["SubItemProject"] = item.SubItemProject; + //row["SubProject"] = item.SubProject; + //row["SubItemProject"] = item.SubItemProject; row["ProjectCode"] = item.ProjectCode; row["ProjectName"] = item.ProjectName; + row["ProjectDescription"] = item.ProjectDescription; + row["UnitOfMeasurement"] = item.UnitOfMeasurement; Model.PHTGL_ContractTrackProgress qContractTrackProgress = new Model.PHTGL_ContractTrackProgress(); qContractTrackProgress.ContractTrackId = item.Id; diff --git a/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractWBS.aspx b/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractWBS.aspx index 045ba4f0..6712bad9 100644 --- a/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractWBS.aspx +++ b/SGGL/FineUIPro.Web/PHTGL/ContractCompile/ContractWBS.aspx @@ -127,7 +127,7 @@ - diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 3245a2b7..afeadd18 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -94622,6 +94622,8 @@ namespace Model private System.Nullable _ProductionState; + private System.Nullable _IsPrint; + private EntityRef _HJGL_Pipeline; #region 可扩展性方法定义 @@ -94662,6 +94664,8 @@ namespace Model partial void OnReceiveDateChanged(); partial void OnProductionStateChanging(System.Nullable value); partial void OnProductionStateChanged(); + partial void OnIsPrintChanging(System.Nullable value); + partial void OnIsPrintChanged(); #endregion public HJGL_Pipeline_Component() @@ -95014,6 +95018,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsPrint", DbType="Bit")] + public System.Nullable IsPrint + { + get + { + return this._IsPrint; + } + set + { + if ((this._IsPrint != value)) + { + this.OnIsPrintChanging(value); + this.SendPropertyChanging(); + this._IsPrint = value; + this.SendPropertyChanged("IsPrint"); + this.OnIsPrintChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_HJGL_Pipeline_Component_HJGL_Pipeline", Storage="_HJGL_Pipeline", ThisKey="PipelineId", OtherKey="PipelineId", IsForeignKey=true)] public HJGL_Pipeline HJGL_Pipeline { @@ -272332,6 +272356,8 @@ namespace Model private string _PipelineCode; + private string _PipelineId; + private string _WeldTypeCode; private string _WeldingMethodCode; @@ -272712,6 +272738,22 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PipelineId", DbType="NVarChar(50)")] + public string PipelineId + { + get + { + return this._PipelineId; + } + set + { + if ((this._PipelineId != value)) + { + this._PipelineId = value; + } + } + } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WeldTypeCode", DbType="NVarChar(50)")] public string WeldTypeCode { From 71dca3c4160bc93c9b37d9ecb117580e6e3b6390 Mon Sep 17 00:00:00 2001 From: fly-l <1420031550@qq.com> Date: Thu, 9 Nov 2023 11:00:38 +0800 Subject: [PATCH 2/2] 2023-11-09 --- SGGL/BLL/Common/Funs.cs | 31 ++++++++ .../PhtglContracttrackService .cs | 15 +++- .../PhtglContracttrackprogressService.cs | 78 +++++++++++++++++++ 3 files changed, 121 insertions(+), 3 deletions(-) diff --git a/SGGL/BLL/Common/Funs.cs b/SGGL/BLL/Common/Funs.cs index cf58f845..adfb9664 100644 --- a/SGGL/BLL/Common/Funs.cs +++ b/SGGL/BLL/Common/Funs.cs @@ -1467,6 +1467,37 @@ namespace BLL return ""; } } + /// + /// List еƽΪList + /// + /// + /// ԭʼList + /// ֺб + /// + /**ȼÿбĴСchunkSizeremainderȻʹһѭбsplitListsС + +ÿεУǸݵǰǷСȷбĴССбС1ȷһб֡ + +ǸstartIndexԱȷȡһбԪطΧ*/ + public static List> SplitList(List originalList, int numberOfLists) + { + List> splitLists = new List>(); + int chunkSize = originalList.Count / numberOfLists; + int remainder = originalList.Count % numberOfLists; + + int startIndex = 0; + for (int i = 0; i < numberOfLists; i++) + { + int sublistSize = chunkSize + (i < remainder ? 1 : 0); + List sublist = originalList.GetRange(startIndex, sublistSize); + splitLists.Add(sublist); + + startIndex += sublistSize; + } + + return splitLists; + } + } } diff --git a/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackService .cs b/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackService .cs index ce936b25..f9dfc9b8 100644 --- a/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackService .cs +++ b/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackService .cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; +using System.Threading.Tasks; using EmitMapper; using EmitMapper.MappingConfiguration; using FineUIPro; @@ -358,7 +359,8 @@ namespace BLL { var responeData = new ResponeData(); List rows; - List goingAddList =new List(); + List thisContractTracks =new List(); + var sheetNames = MiniExcel.GetSheetNames(path); foreach (var sheet in sheetNames) ////多sheet导入 { @@ -376,6 +378,7 @@ namespace BLL ObjectMapperManager.DefaultInstance.GetMapper, List>(); var modeList = mapper.Map(rows); + List goingAddList = new List(); if (modeList.Count == 0) { responeData.code = 0; @@ -401,6 +404,7 @@ namespace BLL item.ProjectCode = item.MainItemCode + "-" + item.ProjectCode; } + if (resultModel!=null) { item.Id = resultModel.Id; @@ -409,10 +413,15 @@ namespace BLL else { item.Id = SQLHelper.GetNewID(); - AddPHTGL_ContractTrack(item); + goingAddList.Add(item); + //AddPHTGL_ContractTrack(item); } - PhtglContracttrackprogressService.CreateTemplateByContractTrackId(item.Id); + thisContractTracks.Add(item); + //PhtglContracttrackprogressService.CreateTemplateByContractTrackId(item.Id); } + + AddBulkPHTGL_ContractTrack(goingAddList); + PhtglContracttrackprogressService.CreateTemplateByContractList(goingAddList,projectid); } return responeData; diff --git a/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackprogressService.cs b/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackprogressService.cs index 7f9a8c83..b5476a22 100644 --- a/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackprogressService.cs +++ b/SGGL/BLL/PHTGL/ContractCompile/PhtglContracttrackprogressService.cs @@ -1,8 +1,10 @@ using System; using System.Collections; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Threading.Tasks; using FineUIPro; using Model; @@ -110,6 +112,7 @@ namespace BLL ContractTrackId = ContractTrackId, Date= month.ToString("yyyy-MM") }; + if (!GetPHTGL_ContractTrackProgressByModle(querymodel).Any()) { var newmodel = new Model.PHTGL_ContractTrackProgress(); @@ -122,6 +125,75 @@ namespace BLL } } } + public static void CreateTemplateByContractList(List contractTrackList,string projectid) + { + var dbcontractTrack=(from x in Funs.DB.PHTGL_ContractTrack where x.ProjectId==projectid select x).ToList(); + var dbContractTrackProgress=(from x in Funs.DB.PHTGL_ContractTrackProgress + join y in Funs.DB.PHTGL_ContractTrack on x.ContractTrackId equals y.Id + where y.ProjectId==projectid select x).ToList(); + + List> splitLists = new List>(); + if (contractTrackList.Count>10) + { + splitLists = Funs.SplitList(contractTrackList, 10); + } + else + { + splitLists = Funs.SplitList(contractTrackList, 1); + } + ConcurrentBag contractTrackProgressList = new ConcurrentBag();//用于批量新增的数据 + + ParallelOptions parallelOptions = new ParallelOptions(); + parallelOptions.MaxDegreeOfParallelism = Environment.ProcessorCount; + + Parallel.ForEach(splitLists, parallelOptions, sublist => + { + + foreach (var item in sublist) + { + var model =( from x in dbcontractTrack where x.Id==item.Id select x).FirstOrDefault() ; + if (model == null) return; + var contractNum = model.ContractNum; + var contractmode = ContractService.GetContractByContractNum(contractNum); + if (contractmode.ContractStartDate != null && contractmode.ContractEndDate != null) + { + var startDate = (DateTime)contractmode.ContractStartDate; + var endDate = (DateTime)contractmode.ContractEndDate; + List months = GetMonthsBetween(startDate, endDate);//获取合同起止日期 + + foreach (DateTime month in months) + { + var querymodel = new Model.PHTGL_ContractTrackProgress + { + ContractTrackId = item.Id, + Date = month.ToString("yyyy-MM") + }; + var q = (from x in dbContractTrackProgress + where + (string.IsNullOrEmpty(querymodel.ContractTrackId) || + x.ContractTrackId.Contains(querymodel.ContractTrackId)) && + (string.IsNullOrEmpty(querymodel.Date) || + x.Date.Contains(querymodel.Date)) + orderby x.Date + select x).ToList() + ; + if (!q.Any()) + { + var newmodel = new Model.PHTGL_ContractTrackProgress(); + newmodel.ContractTrackProgressId = SQLHelper.GetNewID(typeof(Model.PHTGL_ContractTrackProgress)); + newmodel.ContractTrackId = item.Id; + newmodel.Date = month.ToString("yyyy-MM"); + contractTrackProgressList.Add(newmodel); + // AddPHTGL_ContractTrackProgress(newmodel); + } + } + } + } // 处理完成后,可以将结果保存到集合或其他地方 + + }); + + AddBulkPHTGL_ContractTrackProgress(contractTrackProgressList.ToList()); + } public static List GetMonthsBetween(DateTime startDate, DateTime endDate) { @@ -157,6 +229,12 @@ namespace BLL Funs.DB.SubmitChanges(); } + public static void AddBulkPHTGL_ContractTrackProgress(List newtableList) + { + Funs.DB.PHTGL_ContractTrackProgress.InsertAllOnSubmit(newtableList); + Funs.DB.SubmitChanges(); + } + public static void UpdatePHTGL_ContractTrackProgress(PHTGL_ContractTrackProgress newtable) { var table = Funs.DB.PHTGL_ContractTrackProgress.FirstOrDefault(x =>