diff --git a/DataBase/hjglDB_7_2024.06.14-02.rar b/DataBase/hjglDB_7_2024.06.14-02.rar new file mode 100644 index 0000000..caeca8f Binary files /dev/null and b/DataBase/hjglDB_7_2024.06.14-02.rar differ diff --git a/DataBase/hjglDB_7_2024.06.17.rar b/DataBase/hjglDB_7_2024.06.17.rar new file mode 100644 index 0000000..a263460 Binary files /dev/null and b/DataBase/hjglDB_7_2024.06.17.rar differ diff --git a/HJGL/.vs/HJGL/config/applicationhost.config b/HJGL/.vs/HJGL/config/applicationhost.config index e47cfd0..1963de0 100644 --- a/HJGL/.vs/HJGL/config/applicationhost.config +++ b/HJGL/.vs/HJGL/config/applicationhost.config @@ -162,7 +162,7 @@ - + @@ -250,7 +250,7 @@ - + diff --git a/HJGL/BLL/Common/Const.cs b/HJGL/BLL/Common/Const.cs index 2392655..05d1ef1 100644 --- a/HJGL/BLL/Common/Const.cs +++ b/HJGL/BLL/Common/Const.cs @@ -112,6 +112,11 @@ namespace BLL /// public const string BtnCancelAuditing = "取消审核"; + /// + /// 发送邮件 + /// + public const string BtnSendEmail = "发送邮件"; + /// /// 焊口取消 /// @@ -655,6 +660,11 @@ namespace BLL #endregion + /// + /// 焊接日报导出 + /// + public const string WeldDailyExportMenuId = "CE3B4B0E-C751-4BA6-A7AF-A46D434AD6DD"; + #endregion #endregion diff --git a/HJGL/BLL/SQLHelper.cs b/HJGL/BLL/SQLHelper.cs index bb0a1d1..c32fa71 100644 --- a/HJGL/BLL/SQLHelper.cs +++ b/HJGL/BLL/SQLHelper.cs @@ -2,6 +2,8 @@ using System; using System.Data; using System.Data.SqlClient; using System.Collections; +using NPOI.SS.Formula.Functions; +using System.Text; namespace BLL { @@ -995,7 +997,5 @@ namespace BLL } return i; } - - - } + } } diff --git a/HJGL/BLL/WeldingProcess/TrustManage/Batch_PointBatchItemService.cs b/HJGL/BLL/WeldingProcess/TrustManage/Batch_PointBatchItemService.cs index b166842..625e135 100644 --- a/HJGL/BLL/WeldingProcess/TrustManage/Batch_PointBatchItemService.cs +++ b/HJGL/BLL/WeldingProcess/TrustManage/Batch_PointBatchItemService.cs @@ -76,7 +76,8 @@ namespace BLL AcceptLevel = pointBatchItem.AcceptLevel, RepairRecordId = pointBatchItem.RepairRecordId, BatchOrder = pointBatchItem.BatchOrder, - IsCompletedPoint=pointBatchItem.IsCompletedPoint + IsCompletedPoint=pointBatchItem.IsCompletedPoint, + EnterDate = pointBatchItem.EnterDate }; db.Batch_PointBatchItem.InsertOnSubmit(newPointBatchItem); db.SubmitChanges(); @@ -204,7 +205,13 @@ namespace BLL db.SubmitChanges(); } - public static void UpdatePointBatchOrder(string pointBatchItemId, int batchOrder) + + /// + /// 批次段完成 + /// + /// + /// + public static void UpdatePointBatchOrder(string pointBatchItemId, bool batchOrder) { Model.HJGLDB db = Funs.DB; Model.Batch_PointBatchItem newPointBatchItem = db.Batch_PointBatchItem.FirstOrDefault(e => e.PointBatchItemId == pointBatchItemId); @@ -305,6 +312,7 @@ namespace BLL newPointBatchItem.AcceptLevel = "Ⅰ"; } newPointBatchItem.IsCompletedPoint = false; + newPointBatchItem.EnterDate = DateTime.Now; BLL.Batch_PointBatchItemService.AddPointBatchItem(newPointBatchItem); // 插入明细表 @@ -322,23 +330,14 @@ namespace BLL && (j.CoverWelderId == coverWelderId || j.BackingWelderId==backingWelderId) && x.PointDate.HasValue select x; - if (Funs.UsingUnit == "TCC11") + if (threeJot.Count() <= 2) { - if (threeJot.Count() <= 1) - { - UpdatePointBatchItem(pointBatchItemId, "1", System.DateTime.Now, null); - UpdateWelderFirst(pointBatchItemId, true); - } + UpdatePointBatchItem(pointBatchItemId, "1", System.DateTime.Now, null); + UpdateWelderFirst(pointBatchItemId, true); + UpdatePointBatchOrder(pointBatchItemId, true); } - else - { - if (threeJot.Count() <= 2) - { - UpdatePointBatchItem(pointBatchItemId, "1", System.DateTime.Now, null); - UpdateWelderFirst(pointBatchItemId, true); - } - } - //// 焊工在这个批首道口RT要覆盖 不要了 + + #region 焊工在这个批首道口RT要覆盖 不要了 //var joints = from x in Funs.DB.Batch_PointBatchItem // join y in Funs.DB.Batch_PointBatch on x.PointBatchId equals y.PointBatchId // join z in Funs.DB.Base_DetectionType on y.DetectionTypeId equals z.DetectionTypeId @@ -351,81 +350,87 @@ namespace BLL // UpdatePointBatchItem(pointBatchItemId, "1", System.DateTime.Now, null); // UpdatePipelineFirst(pointBatchItemId, true); //} + #endregion // 管径大于等于500必点 if (jot.Dia >= 500) { UpdatePointBatchItem(pointBatchItemId, "1", System.DateTime.Now, null); + UpdatePointBatchOrder(pointBatchItemId, true); } if (jot.IsGoldJoint == true) { UpdatePointBatchItem(pointBatchItemId, "1", System.DateTime.Now, null); + UpdatePointBatchOrder(pointBatchItemId, true); } } - // 一个段位的数量 - int dnum = Convert.ToInt32((double)100 / (double)rate.DetectionRateValue); - // 批里未完成点口的焊口 - var totalJot = from x in Funs.DB.Batch_PointBatchItem - join y in Funs.DB.Pipeline_WeldJoint on x.WeldJointId equals y.WeldJointId - where x.PointBatchId == pointBatchId && x.IsCompletedPoint == false - && (y.CoverWelderId==coverWelderId || y.BackingWelderId==backingWelderId) - && y.WeldingDate.HasValue - && (y.IsCancel == false || y.IsCancel == null) - select x; - int totalnum = totalJot.Count(); - // 时间>15处理放globle - //DateTime lastWeldingDate = totalJot.Select(x => x.WeldingDate.Value).Min(); - //if((DateTime.Now.Date- lastWeldingDate).Days>=15) + #region 暂不用了 + //// 一个段位的数量 + //int dnum = Convert.ToInt32((double)100 / (double)rate.DetectionRateValue); - // 该段达到检测比例的数量 - if (dnum == totalnum) - { - var GJot = from x in Funs.DB.Batch_PointBatchItem - join y in Funs.DB.Pipeline_WeldJoint on x.WeldJointId equals y.WeldJointId - where x.PointBatchId == pointBatchId && x.IsCompletedPoint == false - && (y.IsCancel == false || y.IsCancel == null) && y.JointAttribute== "固定F" - select x; + //// 批里未完成点口的焊口 + //var totalJot = from x in Funs.DB.Batch_PointBatchItem + // join y in Funs.DB.Pipeline_WeldJoint on x.WeldJointId equals y.WeldJointId + // where x.PointBatchId == pointBatchId && x.IsCompletedPoint == false + // && (y.CoverWelderId==coverWelderId || y.BackingWelderId==backingWelderId) + // && y.WeldingDate.HasValue + // && (y.IsCancel == false || y.IsCancel == null) + // select x; + //int totalnum = totalJot.Count(); + //// 时间>15处理放globle + ////DateTime lastWeldingDate = totalJot.Select(x => x.WeldingDate.Value).Min(); + ////if((DateTime.Now.Date- lastWeldingDate).Days>=15) - // 先查找固定口数量,如有固定口,则优先点 - if (GJot.Count() > 0) - { - int Gnum = GJot.Count(); - int rnum = Funs.GetRandomNum(1, Gnum); - int j = 1; - foreach (var g in GJot) - { - if (rnum == j) - { - UpdatePointBatchItem(g.PointBatchItemId, "1", System.DateTime.Now, null); - } - j++; - } - } - else - { - int rnum = Funs.GetRandomNum(1, totalnum); - int j = 1; - foreach (var g in totalJot) - { - if (rnum == j) - { - UpdatePointBatchItem(g.PointBatchItemId, "1", System.DateTime.Now, null); - } - j++; - } - } + //// 该段达到检测比例的数量 + //if (dnum == totalnum) + //{ + // var GJot = from x in Funs.DB.Batch_PointBatchItem + // join y in Funs.DB.Pipeline_WeldJoint on x.WeldJointId equals y.WeldJointId + // where x.PointBatchId == pointBatchId && x.IsCompletedPoint == false + // && (y.IsCancel == false || y.IsCancel == null) && y.JointAttribute== "固定F" + // select x; - int batchOrder= GetMaxBatchOrder(pointBatchId); - // 点口后,更新该段批里的所有口为完成点口,并更新分段的顺序 - foreach (var g in totalJot) - { - UpdateIsCompletedPoint(g.PointBatchItemId, true); - UpdatePointBatchOrder(g.PointBatchItemId, batchOrder); - } - } + // // 先查找固定口数量,如有固定口,则优先点 + // if (GJot.Count() > 0) + // { + // int Gnum = GJot.Count(); + // int rnum = Funs.GetRandomNum(1, Gnum); + // int j = 1; + // foreach (var g in GJot) + // { + // if (rnum == j) + // { + // UpdatePointBatchItem(g.PointBatchItemId, "1", System.DateTime.Now, null); + // } + // j++; + // } + // } + // else + // { + // int rnum = Funs.GetRandomNum(1, totalnum); + // int j = 1; + // foreach (var g in totalJot) + // { + // if (rnum == j) + // { + // UpdatePointBatchItem(g.PointBatchItemId, "1", System.DateTime.Now, null); + // } + // j++; + // } + // } + + // //int batchOrder= GetMaxBatchOrder(pointBatchId); + // // 点口后,更新该段批里的所有口为完成点口,并更新分段的顺序 + // foreach (var g in totalJot) + // { + // UpdateIsCompletedPoint(g.PointBatchItemId, true); + // //UpdatePointBatchOrder(g.PointBatchItemId, batchOrder); + // } + //} + #endregion } } @@ -822,17 +827,17 @@ namespace BLL #endregion // 返回进批的顺序 - public static int GetMaxBatchOrder(string pointBatchId) - { - int orderNum = 1; - Model.HJGLDB db = Funs.DB; - var batchItem = db.Batch_PointBatchItem.Where(x => x.PointBatchId == pointBatchId && x.IsCompletedPoint==true); - if (batchItem.Count() > 0) - { - orderNum = (batchItem.Max(x => x.BatchOrder) != null ? batchItem.Max(x => x.BatchOrder).Value : 0) + 1; - } - return orderNum; - } + //public static int GetMaxBatchOrder(string pointBatchId) + //{ + // int orderNum = 1; + // Model.HJGLDB db = Funs.DB; + // var batchItem = db.Batch_PointBatchItem.Where(x => x.PointBatchId == pointBatchId && x.IsCompletedPoint==true); + // if (batchItem.Count() > 0) + // { + // orderNum = (batchItem.Max(x => x.BatchOrder) != null ? batchItem.Max(x => x.BatchOrder).Value : 0) + 1; + // } + // return orderNum; + //} /// diff --git a/HJGL/FineUIPro.Web/FineUIPro.Web.csproj.user b/HJGL/FineUIPro.Web/FineUIPro.Web.csproj.user index 8d0cdf2..0baedd9 100644 --- a/HJGL/FineUIPro.Web/FineUIPro.Web.csproj.user +++ b/HJGL/FineUIPro.Web/FineUIPro.Web.csproj.user @@ -2,7 +2,7 @@ ProjectFiles - Debug|Any CPU + Release|Any CPU true diff --git a/HJGL/FineUIPro.Web/Global.asax.cs b/HJGL/FineUIPro.Web/Global.asax.cs index 3c0f36d..32e6b03 100644 --- a/HJGL/FineUIPro.Web/Global.asax.cs +++ b/HJGL/FineUIPro.Web/Global.asax.cs @@ -47,8 +47,8 @@ } // 开启线程 - System.Threading.Thread LoadServiceData = new System.Threading.Thread(new System.Threading.ThreadStart(ExpirePoint)); - LoadServiceData.Start(); + //System.Threading.Thread LoadServiceData = new System.Threading.Thread(new System.Threading.ThreadStart(ExpirePoint)); + //LoadServiceData.Start(); // 开启超焊信息提取 System.Threading.Thread LoadServiceSuperQue = new System.Threading.Thread(new System.Threading.ThreadStart(SuperQueWelding)); @@ -137,12 +137,12 @@ } } - int batchOrder = BLL.Batch_PointBatchItemService.GetMaxBatchOrder(r["PointBatchId"].ToString()); + //int batchOrder = BLL.Batch_PointBatchItemService.GetMaxBatchOrder(r["PointBatchId"].ToString()); // 点口后,更新该段批里的所有口为完成点口,并更新分段的顺序 foreach (var g in jotList) { BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); - BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, batchOrder); + //BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, batchOrder); } } } @@ -162,13 +162,14 @@ void SuperQueWelding_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { - bool canWPS = true; var jotList = (from x in Funs.DB.Pipeline_WeldJoint where x.WeldingDailyId != null && x.WeldingMethodId != null select x).ToList(); foreach (var jot in jotList) { var wps = BLL.WPQListServiceService.GetWPQById(jot.WPQId); string floorWelder = jot.BackingWelderId; string cellWelder = jot.CoverWelderId; + + bool canWPS = true; if (wps != null) { // 验证焊工WPS资质 @@ -203,7 +204,11 @@ decimal? sch = jot.Thickness; string[] wmeCodes = mat.WeldingMethodCode.Split('+'); - string location = loc.WeldingLocationCode; + string location = string.Empty; + if (loc != null) + { + location = loc.WeldingLocationCode; + } string ste = jot.Material1Id; List floorWelderQualifys = (from x in Funs.DB.Welder_WelderQualify @@ -261,13 +266,16 @@ } } - if (canWPS == false || canSave == false) { jot.IsSuperQueWelding = true; - Funs.DB.SubmitChanges(); } - } + else + { + jot.IsSuperQueWelding = null; + } + } + Funs.DB.SubmitChanges(); } protected void Session_Start(object sender, EventArgs e) diff --git a/HJGL/FineUIPro.Web/Web.config b/HJGL/FineUIPro.Web/Web.config index 9ecdad1..f550ed2 100644 --- a/HJGL/FineUIPro.Web/Web.config +++ b/HJGL/FineUIPro.Web/Web.config @@ -51,7 +51,7 @@ - + diff --git a/HJGL/FineUIPro.Web/WelderManage/QualifiedProject.aspx b/HJGL/FineUIPro.Web/WelderManage/QualifiedProject.aspx index 1c8c820..16da018 100644 --- a/HJGL/FineUIPro.Web/WelderManage/QualifiedProject.aspx +++ b/HJGL/FineUIPro.Web/WelderManage/QualifiedProject.aspx @@ -88,13 +88,13 @@ + HeaderTextAlign="Center" TextAlign="Center" Locked="true" Hidden="true"> + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" HeaderText="考试项目" Locked="true" Hidden="true"> + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" HeaderText="是否合格" Locked="true" Hidden="true"> diff --git a/HJGL/FineUIPro.Web/WelderManage/QualifiedProjectEdit.aspx b/HJGL/FineUIPro.Web/WelderManage/QualifiedProjectEdit.aspx index df0b2c4..b80852a 100644 --- a/HJGL/FineUIPro.Web/WelderManage/QualifiedProjectEdit.aspx +++ b/HJGL/FineUIPro.Web/WelderManage/QualifiedProjectEdit.aspx @@ -41,19 +41,19 @@ - + - + - + diff --git a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx index 1b487af..4fe0b11 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx +++ b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx @@ -120,6 +120,9 @@ + + @@ -147,11 +150,10 @@ HeaderTextAlign="Center" TextAlign="Left" Width="120px"> - + FieldType="String" TextAlign="Left" Width="150px" Hidden="true"> + DataField="Acceptance" FieldType="String" TextAlign="Left" Width="150px" Hidden="true"> diff --git a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.cs b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.cs index 7ceed36..917d8a9 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.cs @@ -1,17 +1,13 @@ -using System; +using BLL; +using System; using System.Collections.Generic; -using System.Data; using System.Data.SqlClient; -using System.IO; +using System.Data; using System.Linq; -using System.Web; -using BLL; -using Model; -using NPOI.HSSF.Util; using NPOI.SS.UserModel; -using NPOI.SS.Util; using NPOI.XSSF.UserModel; + namespace FineUIPro.Web.WeldingProcess.PMI { public partial class PMIDelegation : PageBase @@ -69,7 +65,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI this.tvControlItem.Nodes.Add(rootNode); List trustLists = new List(); ///PMI委托单 - + if (!string.IsNullOrEmpty(this.txtSearchNo.Text.Trim())) { trustLists = (from x in Funs.DB.PMI_Delegation where x.ProjectId == CurrUser.LoginProjectId && x.DelegationNo.Contains(this.txtSearchNo.Text.Trim()) orderby x.DelegationNo select x).ToList(); @@ -144,7 +140,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) { - var result = Funs.DB.PMI_Delegation.FirstOrDefault(t => t.Id == this.tvControlItem.SelectedNodeID); + var result = Funs.DB.PMI_Delegation.FirstOrDefault(t=>t.Id==this.tvControlItem.SelectedNodeID); if (result != null) { this.PMIDelegationId = result.Id; @@ -188,7 +184,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI /// private void PageInfoLoad() { - var trust = Funs.DB.PMI_Delegation.FirstOrDefault(t => t.Id == this.PMIDelegationId); + var trust =Funs.DB.PMI_Delegation.FirstOrDefault(t=>t.Id==this.PMIDelegationId); if (trust != null) { this.txtDelegationNo.Text = trust.DelegationNo; @@ -283,7 +279,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.PMIDelegationMenuId, Const.BtnAdd)) { this.SetTextTemp(); - string window = String.Format("PMIDelegationEdit.aspx?PMIDelegationId={0}", string.Empty, "新增 - "); + string window = String.Format("PMIDelegationEdit.aspx?PMIDelegationId={0}", string.Empty, "新增 - ") ; PageContext.RegisterStartupScript(Window2.GetSaveStateReference(this.hdPMIDelegationId.ClientID) + Window2.GetShowReference(window)); } @@ -303,7 +299,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI { if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HotProessTrustMenuId, Const.BtnSave)) { - var trustManage = Funs.DB.PMI_Delegation.FirstOrDefault(t => t.Id == this.PMIDelegationId); + var trustManage = Funs.DB.PMI_Delegation.FirstOrDefault (t=>t.Id==this.PMIDelegationId); if (trustManage != null) { string openUrl = String.Format("PMIDelegationEdit.aspx?PMIDelegationId={0}", this.PMIDelegationId, "编辑 - "); @@ -332,9 +328,9 @@ namespace FineUIPro.Web.WeldingProcess.PMI { if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.PMIDelegationMenuId, Const.BtnDelete)) { - var trustManage = Funs.DB.PMI_Delegation.FirstOrDefault(t => t.Id == this.PMIDelegationId); + var trustManage =Funs.DB.PMI_Delegation.FirstOrDefault (t=>t.Id==this.PMIDelegationId); if (trustManage != null) - { + { //删除主表数据 Funs.DB.PMI_Delegation.DeleteOnSubmit(trustManage); //删除 明细表 @@ -371,7 +367,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI { this.InitTreeMenu(); this.BindGrid(); - + } #region 查询 @@ -387,435 +383,51 @@ namespace FineUIPro.Web.WeldingProcess.PMI #endregion #endregion - #region 获取按钮权限 - /// - /// 获取按钮权限 - /// - /// - /// - private bool GetButtonPower(string button) - { - return BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.DailyReportCompleteMenuId, button); - } - - #endregion - - /// - /// 打印 - /// protected void btnExport_Click(object sender, EventArgs e) { - if (string.IsNullOrWhiteSpace(this.tvControlItem.SelectedNodeID)) - { - Alert.ShowInTop("请选择委托单!", MessageBoxIcon.Warning); - return; - } - string rootPath = Server.MapPath("~/") + Const.ExcelUrl; - //导出文件 - string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; - if (!Directory.Exists(filePath)) - { - Directory.CreateDirectory(filePath); - } - string ReportFileName = filePath + "out.xlsx"; - int rowIndex = 0; - XSSFWorkbook hssfworkbook = new XSSFWorkbook(); - XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("无损检测委托单(PMI)"); + Alert.ShowInTop("待开发!", MessageBoxIcon.Warning); + return; + //if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_BatchTrustMenuId, Const.BtnOut)) + //{ - #region 列宽 - - ws.SetColumnWidth(0, 6 * 256); - ws.SetColumnWidth(1, 4 * 256); - ws.SetColumnWidth(2, 6 * 256); - ws.SetColumnWidth(3, 6 * 256); - ws.SetColumnWidth(4, 6 * 256); - ws.SetColumnWidth(5, 6 * 256); - ws.SetColumnWidth(6, 9 * 256); - ws.SetColumnWidth(7, 9 * 256); - ws.SetColumnWidth(8, 5 * 256); - ws.SetColumnWidth(9, 5 * 256); - ws.SetColumnWidth(10, 5 * 256); - ws.SetColumnWidth(11, 8 * 256); - ws.SetColumnWidth(12, 9 * 256); - ws.SetColumnWidth(13, 11 * 256); - - #endregion - - string pmiId = this.tvControlItem.SelectedNodeID; - //头部 - var pmititle = Funs.DB.PMI_Delegation.FirstOrDefault(x => x.Id == pmiId); - //列表 - List listStr = new List(); - listStr.Add(new SqlParameter("@ProjectId", pmititle != null ? pmititle.ProjectId : this.CurrUser.LoginProjectId)); - listStr.Add(new SqlParameter("@PMIID", this.PMIDelegationId)); - SqlParameter[] parameter = listStr.ToArray(); - var tb = SQLHelper.GetDataTableRunText("SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID", parameter); - - //模拟多页数据sql - //var tb = SQLHelper.GetDataTableRunText("SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID union all SELECT * FROM View_PMI_DelegationDetails WHERE ProjectId=@ProjectId AND PMIID=@PMIID", parameter); - - - var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true, false); - var styleButton = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true, false); - var styleTop = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true, false); - var styleNone = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true, false); - - if (tb.Rows.Count > 0 && pmititle != null) - { - var tbNum = tb.Rows.Count; - var pageNum = - tbNum < 15 ? 1 - : Math.Ceiling((float)(tbNum - 14) / 14) + 1; - - //循环页 - for (int i = 1; i <= pageNum; i++) - { - - #region 头部 - - ws = WsExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex + 12, style, 0, 13, 1); - //行0 - CellRangeAddress region = new CellRangeAddress(rowIndex, rowIndex + 3, 0, 3); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(0).SetCellValue("NDE-002"); - ws.GetRow(rowIndex).GetCell(0).CellStyle = style; - ws.GetRow(rowIndex).GetCell(1).CellStyle = style; - ws.GetRow(rowIndex).GetCell(2).CellStyle = style; - ws.GetRow(rowIndex).GetCell(3).CellStyle = style; - - region = new CellRangeAddress(rowIndex, rowIndex + 3, 4, 10); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(4).SetCellValue("无损检测委托单\r\nPMI"); - ws.GetRow(rowIndex).GetCell(4).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 16, true, true); - ws.GetRow(rowIndex).GetCell(5).CellStyle = style; - ws.GetRow(rowIndex).GetCell(6).CellStyle = style; - ws.GetRow(rowIndex).GetCell(7).CellStyle = style; - ws.GetRow(rowIndex).GetCell(8).CellStyle = style; - ws.GetRow(rowIndex).GetCell(9).CellStyle = style; - ws.GetRow(rowIndex).GetCell(10).CellStyle = style; - - region = new CellRangeAddress(rowIndex, rowIndex, 11, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex).GetCell(11).SetCellValue("工程名称:巴斯夫(广东)一体化项目专用化学品二区"); - ws.GetRow(rowIndex).GetCell(11).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Justify, 10.5, true, false); - ws.GetRow(rowIndex).GetCell(12).CellStyle = styleButton; - ws.GetRow(rowIndex).GetCell(13).CellStyle = styleButton; - - //行1 - region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 11, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue("BASF (Guangdong) Integrated Project Citral Cluster"); - ws.GetRow(rowIndex + 1).GetCell(11).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Justify, 10.5, true, false); - ws.GetRow(rowIndex + 1).GetCell(12).CellStyle = styleNone; - ws.GetRow(rowIndex + 1).GetCell(13).CellStyle = styleNone; - - //行2 - region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 11, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 2).GetCell(11).SetCellValue("单元名称:"); - ws.GetRow(rowIndex + 2).GetCell(11).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Justify, 10.5, true, false); - ws.GetRow(rowIndex + 2).GetCell(12).CellStyle = styleNone; - ws.GetRow(rowIndex + 2).GetCell(13).CellStyle = styleNone; - - //行3 - region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 11, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 3).GetCell(11).SetCellValue("Unit Name:"); - ws.GetRow(rowIndex + 3).GetCell(11).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Justify, 10.5, true, false); - ws.GetRow(rowIndex + 3).GetCell(12).CellStyle = styleTop; - ws.GetRow(rowIndex + 3).GetCell(13).CellStyle = styleTop; - - //行4 - region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 4).GetCell(0).SetCellValue("委托单位"); - region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 2, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 4).GetCell(2).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 7, 8); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 4).GetCell(7).SetCellValue("委托编号"); - region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 9, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 4).GetCell(9).SetCellValue(""); - - //行5 - region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("检测单位"); - region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 2, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 5).GetCell(2).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 7, 8); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 5).GetCell(7).SetCellValue("检测方法"); - region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 9, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 5).GetCell(9).SetCellValue(""); - - //行6 - region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("检件名称"); - region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 2, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 6).GetCell(2).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 7, 8); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 6).GetCell(7).SetCellValue("表面状态"); - region = new CellRangeAddress(rowIndex + 6, rowIndex + 6, 9, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 6).GetCell(9).SetCellValue(""); - - //行7 - region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 7).GetCell(0).SetCellValue("检测标准"); - region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 2, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 7).GetCell(2).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 7, 8); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 7).GetCell(7).SetCellValue("检测比例"); - region = new CellRangeAddress(rowIndex + 7, rowIndex + 7, 9, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 7).GetCell(9).SetCellValue(""); - - //行8 - region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 8).GetCell(0).SetCellValue("转动口/固定口"); - region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 2, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 8).GetCell(2).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 7, 8); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 8).GetCell(7).SetCellValue("委托日期"); - region = new CellRangeAddress(rowIndex + 8, rowIndex + 8, 9, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 8).GetCell(9).SetCellValue(""); - - //行9 - region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 9).GetCell(0).SetCellValue("焊接方法"); - region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 2, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 9).GetCell(2).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 7, 8); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 9).GetCell(7).SetCellValue("压力管道分级"); - region = new CellRangeAddress(rowIndex + 9, rowIndex + 9, 9, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 9).GetCell(9).SetCellValue(""); - - //行10 - region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 0, 1); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 10).GetCell(0).SetCellValue("检测时机"); - region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 2, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 10).GetCell(2).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 7, 8); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 10).GetCell(7).SetCellValue("被检产品标准"); - region = new CellRangeAddress(rowIndex + 10, rowIndex + 10, 9, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 10).GetCell(9).SetCellValue(""); - - //行12 - region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 0, 2); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 11).GetCell(0).SetCellValue("检件编号/管线号"); - region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 3, 4); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 11).GetCell(3).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 5, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 11).GetCell(5).SetCellValue("焊口总数"); - region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 7, 9); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 11).GetCell(7).SetCellValue(""); - region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 10, 11); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 11).GetCell(10).SetCellValue("抽检数量"); - region = new CellRangeAddress(rowIndex + 11, rowIndex + 11, 12, 13); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 11).GetCell(12).SetCellValue(""); - - //行13 - ws.GetRow(rowIndex + 12).GetCell(0).SetCellValue("检测\r\n部位"); - region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 1, 3); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 12).GetCell(1).SetCellValue("检件编号/管线号"); - ws.GetRow(rowIndex + 12).GetCell(4).SetCellValue("焊口号"); - region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 5, 6); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 12).GetCell(5).SetCellValue("焊工代号"); - region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 7, 10); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 12).GetCell(7).SetCellValue("检件材质"); - region = new CellRangeAddress(rowIndex + 12, rowIndex + 12, 11, 12); - ws.AddMergedRegion(region); - ws.GetRow(rowIndex + 12).GetCell(11).SetCellValue("检件规格(mm)"); - ws.GetRow(rowIndex + 12).GetCell(13).SetCellValue("备注"); - - #endregion - - #region 表格 - - ws = WsExcelCreateRow(ws, hssfworkbook, rowIndex + 13, rowIndex + 26, style, 0, 13, 2); - var dataTit = rowIndex + 13; - var tIndex = 12 + 14; - var dStart = 0; - var dEnd = 0; - if (i == 1) - { - dStart = 0; - dEnd = 14; - } - else - { - dStart = i == 2 ? 14 : ((i - 2) * 14) + 14; - dEnd = ((i - 1) * 14) + 14; - } - - //合并单元格 - for (int hb = dataTit; hb <= rowIndex + tIndex; hb++) - { - region = new CellRangeAddress(hb, hb, 1, 3); - ws.AddMergedRegion(region); - region = new CellRangeAddress(hb, hb, 5, 6); - ws.AddMergedRegion(region); - region = new CellRangeAddress(hb, hb, 7, 10); - ws.AddMergedRegion(region); - region = new CellRangeAddress(hb, hb, 11, 12); - ws.AddMergedRegion(region); - } - //获取当前页数据 - var pageTb = GetPageToTable(tb, dStart, dEnd); - for (int j = 0; j < pageTb.Rows.Count; j++) - { - int dataIndex = dataTit + j; - //检测部位 - ws.GetRow(dataIndex).GetCell(0).SetCellValue(""); - //检件编号/管线号 - ws.GetRow(dataIndex).GetCell(1).SetCellValue("数据待绑定"); - //焊口号 - ws.GetRow(dataIndex).GetCell(4).SetCellValue(""); - //焊工代号 - ws.GetRow(dataIndex).GetCell(5).SetCellValue(""); - //检件材质 - ws.GetRow(dataIndex).GetCell(7).SetCellValue(""); - //检件规格(mm) - ws.GetRow(dataIndex).GetCell(11).SetCellValue(""); - //备注 - ws.GetRow(dataIndex).GetCell(13).SetCellValue(""); - } - if (dataTit + pageTb.Rows.Count < 26) - { - ws.GetRow(dataTit + pageTb.Rows.Count).GetCell(0).SetCellValue("以下空白"); - } - - rowIndex += tIndex; - - #endregion - - #region 尾部 - - ws = WsExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 9, style, 0, 13, 3); - //合并单元格 - for (int hb = rowIndex + 1; hb <= rowIndex + 9; hb++) - { - for (int c = 0; c <= 13; c++) - { - if (hb >= rowIndex + 2 && hb <= rowIndex + 3) - { - ws.GetRow(hb).GetCell(c).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Left, 10.5, true, false); - } - if (hb >= rowIndex + 4 && hb <= rowIndex + 8) - { - ws.GetRow(hb).GetCell(c).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Right, 10.5, true, false); - } - if (hb == rowIndex + 9) - { - ws.GetRow(hb).GetCell(c).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10.5, true, false); - } - } - region = new CellRangeAddress(hb, hb, 0, 2); - ws.AddMergedRegion(region); - region = new CellRangeAddress(hb, hb, 3, 5); - ws.AddMergedRegion(region); - region = new CellRangeAddress(hb, hb, 6, 7); - ws.AddMergedRegion(region); - region = new CellRangeAddress(hb, hb, 8, 11); - ws.AddMergedRegion(region); - region = new CellRangeAddress(hb, hb, 12, 13); - ws.AddMergedRegion(region); - } - //尾部行1 - ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("施工单位"); - ws.GetRow(rowIndex + 1).GetCell(3).SetCellValue("监理单位"); - ws.GetRow(rowIndex + 1).GetCell(6).SetCellValue("管理公司"); - ws.GetRow(rowIndex + 1).GetCell(8).SetCellValue("建设单位"); - ws.GetRow(rowIndex + 1).GetCell(12).SetCellValue("检测单位"); - //尾部行2 - ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue(""); - ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue(""); - ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue(""); - ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue(""); - ws.GetRow(rowIndex + 2).GetCell(12).SetCellValue(""); - //尾部行3 - ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue("质量检测员:"); - ws.GetRow(rowIndex + 3).GetCell(3).SetCellValue("专业工程师:"); - ws.GetRow(rowIndex + 3).GetCell(6).SetCellValue("专业/质量工程师:"); - ws.GetRow(rowIndex + 3).GetCell(8).SetCellValue("业主代表:"); - ws.GetRow(rowIndex + 3).GetCell(12).SetCellValue("接收人:"); - - //尾部行6 - ws.GetRow(rowIndex + 6).GetCell(0).SetCellValue("专业工程师:"); - //尾部行8 - ws.GetRow(rowIndex + 8).GetCell(0).SetCellValue(" 年 月 日"); - ws.GetRow(rowIndex + 8).GetCell(3).SetCellValue(" 年 月 日"); - ws.GetRow(rowIndex + 8).GetCell(6).SetCellValue(" 年 月 日"); - ws.GetRow(rowIndex + 8).GetCell(8).SetCellValue(" 年 月 日"); - ws.GetRow(rowIndex + 8).GetCell(12).SetCellValue(" 年 月 日"); - - #endregion - - ws = WsExcelCreateRow(ws, hssfworkbook, rowIndex + 10, rowIndex + 10, style, 0, 13, 3, true); - rowIndex += 11; - } - } - ws.SetMargin(MarginType.LeftMargin, 0.3); - ws.SetMargin(MarginType.RightMargin, 0.2); - ws.SetMargin(MarginType.BottomMargin, 0.4); - ws.PrintSetup.Landscape = false; - ws.PrintSetup.PaperSize = 9; - ws.ForceFormulaRecalculation = true; - - using (FileStream filess = System.IO.File.OpenWrite(ReportFileName)) - { - hssfworkbook.Write(filess); - } - FileInfo filet = new FileInfo(ReportFileName); - Response.Clear(); - Response.Charset = "GB2312"; - Response.ContentEncoding = System.Text.Encoding.UTF8; - // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 - Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode("无损检测委托单(PMI).xlsx")); - // 添加头信息,指定文件大小,让浏览器能够显示下载进度 - Response.AddHeader("Content-Length", filet.Length.ToString()); - // 指定返回的是一个不能被客户端读取的流,必须被下载 - Response.ContentType = "application/ms-excel"; - // 把文件流发送到客户端 - Response.WriteFile(filet.FullName); - // 停止页面的执行 - Response.End(); + // if (string.IsNullOrWhiteSpace(this.tvControlItem.SelectedNodeID)) + // { + // Alert.ShowInTop("请选择委托单!", MessageBoxIcon.Warning); + // return; + // } + // string rootPath = Server.MapPath("~/") + Const.ExcelUrl; + // //导出文件 + // string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; + // if (!Directory.Exists(filePath)) + // { + // Directory.CreateDirectory(filePath); + // } + // string ReportFileName = filePath + "out1.xlsx"; + // int rowIndex = 0; + // XSSFWorkbook hssfworkbook = new XSSFWorkbook(); + // XSSFSheet ws = new XSSFSheet(); + // string trustBatchId = this.tvControlItem.SelectedNodeID; + //} + //else + //{ + // ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning); + //} } #region 私有方法 + /// + /// 获取某一列的所有值 + /// + /// 列数据类型 + /// 数据表 + /// 列名 + /// + public static List GetColumnValues(DataTable dtSource, string filedName) + { + return (from r in dtSource.AsEnumerable() select r.Field(filedName)).ToList(); + } + /// /// 无损检测委托单行和列 /// @@ -869,7 +481,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI } /// - /// 行和列 + /// 材料及配件检测委托单行和列 /// /// private XSSFSheet ClExcelCreateRow(XSSFSheet ws, XSSFWorkbook hssfworkbook, int sRows, int eRows, ICellStyle style, int cStart, int cEnd, bool istitle = false, bool isnobk = false) @@ -896,7 +508,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI ws.GetRow(i).CreateCell(j); if (isnobk) { - ws.GetRow(i).GetCell(j).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true, false); + ws.GetRow(i).GetCell(j).CellStyle = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, NPOI.SS.UserModel.BorderStyle.None, NPOI.SS.UserModel.BorderStyle.None, VerticalAlignment.Center, HorizontalAlignment.Center, 10, true, false); } else { @@ -941,5 +553,18 @@ namespace FineUIPro.Web.WeldingProcess.PMI #endregion + #region 获取按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private bool GetButtonPower(string button) + { + return BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.DailyReportCompleteMenuId, button); + } + #endregion + + } } \ No newline at end of file diff --git a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.designer.cs b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.designer.cs index 5ec04cf..3192868 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.designer.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.designer.cs @@ -266,6 +266,15 @@ namespace FineUIPro.Web.WeldingProcess.PMI /// protected global::FineUIPro.ToolbarFill ToolbarFill2; + /// + /// btnExport 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnExport; + /// /// ToolbarSeparator1 控件。 /// diff --git a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegationEdit.aspx b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegationEdit.aspx index 3881793..7cf0463 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegationEdit.aspx +++ b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegationEdit.aspx @@ -117,14 +117,14 @@ TextAlign="Left" Width="220px"> + FieldType="String" TextAlign="Left" Width="150px" Hidden="true"> + DataField="Acceptance" FieldType="String" TextAlign="Left" Width="150px" Hidden="true"> diff --git a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegationEdit.aspx.cs b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegationEdit.aspx.cs index cb2e8ca..0ecda88 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegationEdit.aspx.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegationEdit.aspx.cs @@ -85,7 +85,15 @@ namespace FineUIPro.Web.WeldingProcess.PMI this.drpUnitId.SelectedValue = trust.UnitId; } this.txtDetectionMethod.Text = "PMI光谱分析"; - this.txtDetectionStandard.Text = trust.DetectionStandard; + if (!string.IsNullOrEmpty(trust.DetectionStandard)) + { + this.txtDetectionStandard.Text = trust.DetectionStandard; + } + else + { + txtDetectionStandard.Text = "GB 50184-2011"; + } + if (!string.IsNullOrEmpty(trust.Tabler)) { this.txtTabler.Text = BLL.Sys_UserService.GetUserNameByUserId(trust.Tabler); @@ -94,6 +102,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI } else { + txtDetectionStandard.Text = "GB 50184-2011"; this.txtTabler.Text = this.CurrUser.UserName; this.SimpleForm1.Reset(); //重置所有字段 } diff --git a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDetectionEntry.aspx b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDetectionEntry.aspx index b6a4148..70b2aa5 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDetectionEntry.aspx +++ b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDetectionEntry.aspx @@ -151,10 +151,10 @@ TextAlign="Center" Width="160px"> + FieldType="String" TextAlign="Left" Width="150px" Hidden="true"> + DataField="Acceptance" FieldType="String" TextAlign="Left" Width="150px" Hidden="true"> <%-- 检测日期 --%> + + + + + + + diff --git a/HJGL/FineUIPro.Web/WeldingProcess/TrustManage/PointManage.aspx.cs b/HJGL/FineUIPro.Web/WeldingProcess/TrustManage/PointManage.aspx.cs index 4e74784..b72ee31 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/TrustManage/PointManage.aspx.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/TrustManage/PointManage.aspx.cs @@ -854,6 +854,332 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage } } + /// + /// 日报完成点口 + /// + /// + /// + protected void btnDailyCompPoint_Click(object sender, EventArgs e) + { + if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PointManageMenuId, Const.BtnOpenResetPoint)) + { + string strSql = @"SELECT jot.ProjectId, pItem.PointBatchId,jot.CoverWelderId,rate.DetectionRateValue + FROM dbo.Batch_PointBatchItem pItem + LEFT JOIN dbo.Batch_PointBatch point ON point.PointBatchId = pItem.PointBatchId + LEFT JOIN dbo.Pipeline_WeldJoint jot ON jot.WeldJointId = pItem.WeldJointId + LEFT JOIN dbo.Base_DetectionRate rate ON rate.DetectionRateId=point.DetectionRateId + WHERE pItem.IsCompletedPoint=0 + GROUP BY jot.ProjectId, pItem.PointBatchId,jot.CoverWelderId,rate.DetectionRateValue"; + DataTable dt = SQLHelper.GetDataTableRunText(strSql, null); + if (dt.Rows.Count > 0) + { + foreach (DataRow r in dt.Rows) + { + // 已处理但批段未关闭的焊口 + List batchNoClose = (from x in Funs.DB.Batch_PointBatchItem + join y in Funs.DB.Pipeline_WeldJoint on x.WeldJointId equals y.WeldJointId + where x.PointBatchId == r["PointBatchId"].ToString() + && y.CoverWelderId == r["CoverWelderId"].ToString() + && (x.BatchOrder == false || x.BatchOrder == null) + && x.IsCompletedPoint == true + && (y.IsCancel == false || y.IsCancel == null) + select new PointBatchList { PointBatchItemId = x.PointBatchItemId, JointAttribute = y.JointAttribute }).ToList(); + + // 未处理焊口 + List jotList = (from x in Funs.DB.Batch_PointBatchItem + join y in Funs.DB.Pipeline_WeldJoint on x.WeldJointId equals y.WeldJointId + where x.PointBatchId == r["PointBatchId"].ToString() + && y.CoverWelderId == r["CoverWelderId"].ToString() + && (x.IsCompletedPoint == false || x.IsCompletedPoint == null) + && (y.IsCancel == false || y.IsCancel == null) + orderby x.EnterDate + select new PointBatchList { PointBatchItemId = x.PointBatchItemId, JointAttribute = y.JointAttribute }).ToList(); + + // 未处理固定焊口 + List GJot = jotList.Where(x=>x.JointAttribute == "固定F").ToList(); + + if (Convert.ToInt32(r["DetectionRateValue"]) != 0) + { + // 批中一段的数量 + int dnum = Convert.ToInt32((double)100 / (int)r["DetectionRateValue"]); + // 已处理但批段未关闭的焊口数量 + int batchNoCloseNum = batchNoClose.Count(); + // 未处理焊口数量 + int jotListNum = jotList.Count(); + // 未处理固定焊口数量 + int GJotNum = GJot.Count(); + + #region batchNoCloseNum大于0表示批段已处理但批段未关闭的焊口集合里,些批段已点口 + if (batchNoCloseNum > 0) + { + if ((batchNoCloseNum + jotListNum) > dnum) + { + // 关闭上一个批段还需要的数量 + int closeNum = dnum - batchNoCloseNum; + var bachtclose = jotList.GetRange(0, closeNum); + // 补足上一个批段,关闭同时状态为已处理 + foreach (var g in bachtclose) + { + BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, true); + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + } + foreach (var g in batchNoClose) + { + BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, true); + } + + if ((jotListNum - closeNum) > dnum) + { + // 取模(余数) + int modelNum = (jotListNum - closeNum) % dnum; + // 取整 + double doubleNum = Math.Ceiling((double)((jotListNum - closeNum) / (double)dnum)); + int intNum = Convert.ToInt32(doubleNum); + // 补足上一个批段后剩余的待处理的列表 + var remailList = jotList.GetRange(closeNum, (jotListNum - closeNum)); + + for (int i = 0; i < intNum; i++) + { + if (modelNum == 0) + { + var bachtOrder = remailList.GetRange(i * dnum, dnum); + var bachtOrderG = bachtOrder.Where(p => p.JointAttribute == "固定F").ToList(); + // 点口 + GetRandomPoint(bachtOrderG, bachtOrder); + // 状态为已处理状态,并关闭此批段 + foreach (var g in bachtOrder) + { + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, true); + } + } + else + { + if (i != intNum - 1) + { + var bachtOrder = remailList.GetRange(i * dnum, dnum); + var bachtOrderG = bachtOrder.Where(p => p.JointAttribute == "固定F").ToList(); + // 点口 + GetRandomPoint(bachtOrderG, bachtOrder); + // 状态为已处理状态,并关闭此批段 + foreach (var g in bachtOrder) + { + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, true); + } + } + // 最后一个段 + else + { + var bachtOrder = remailList.GetRange(i * dnum, modelNum); + var bachtOrderG = bachtOrder.Where(p => p.JointAttribute == "固定F").ToList(); + // 点口 + GetRandomPoint(bachtOrderG, bachtOrder); + // 状态为已处理状态,此批段不关闭 + foreach (var g in bachtOrder) + { + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + } + } + } + + } + } + else if ((jotListNum - closeNum) == dnum) + { + var bachtOrder = jotList.GetRange(closeNum, (jotListNum - closeNum)); + var bachtOrderG = bachtOrder.Where(p => p.JointAttribute == "固定F").ToList(); + // 点口 + GetRandomPoint(bachtOrderG, bachtOrder); + + // 状态为已处理状态,并关闭此批段 + foreach (var g in bachtOrder) + { + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, true); + } + } + else + { + var bachtOrder = jotList.GetRange(closeNum, (jotListNum - closeNum)); + var bachtOrderG = bachtOrder.Where(p => p.JointAttribute == "固定F").ToList(); + // 点口 + GetRandomPoint(bachtOrderG, bachtOrder); + + // 状态为已处理状态,此批段没关闭 + foreach (var g in bachtOrder) + { + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + } + } + + } + + // 当未关闭的批段+未处理焊口的数量等于探伤比例数量时批段关闭 + else if (batchNoCloseNum + jotListNum == dnum) + { + // 批段关闭 + foreach (var g in batchNoClose) + { + BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, true); + } + // 批段关闭,状态为已处理 + foreach (var g in jotList) + { + BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, true); + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + } + } + else + { + // 待处理完成,但批段未关闭 + foreach (var g in jotList) + { + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + } + } + } + #endregion + + #region batchNoCloseNum等于0表示这个批段开始 + else + { + if (jotListNum > dnum) + { + // 取模(余数) + int modelNum = jotList.Count() % dnum; + // 取整 + double doubleNum = Math.Ceiling((double)jotList.Count() / (double)dnum); + int intNum=Convert.ToInt32(doubleNum); + + for (int i = 0; i < intNum; i++) + { + if (modelNum == 0) + { + var bachtOrder = jotList.GetRange(i * dnum, dnum); + var bachtOrderG = bachtOrder.Where(p => p.JointAttribute == "固定F").ToList(); + // 点口 + GetRandomPoint(bachtOrderG, bachtOrder); + // 状态为已处理状态,并关闭此批段 + foreach (var g in bachtOrder) + { + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, true); + } + } + else + { + if (i != intNum - 1) + { + var bachtOrder = jotList.GetRange(i * dnum, dnum); + var bachtOrderG = bachtOrder.Where(p => p.JointAttribute == "固定F").ToList(); + // 点口 + GetRandomPoint(bachtOrderG, bachtOrder); + // 状态为已处理状态,并关闭此批段 + foreach (var g in bachtOrder) + { + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, true); + } + } + // 最后一个段 + else + { + var bachtOrder = jotList.GetRange(i * dnum, modelNum); + var bachtOrderG = bachtOrder.Where(p => p.JointAttribute == "固定F").ToList(); + // 点口 + GetRandomPoint(bachtOrderG, bachtOrder); + // 状态为已处理状态,此批段不关闭 + foreach (var g in bachtOrder) + { + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + } + } + } + + } + } + else if (jotListNum == dnum) + { + // 点口 + GetRandomPoint(GJot, jotList); + // 状态为已处理状态,并关闭此批段 + foreach (var g in jotList) + { + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, true); + } + } + else + { + // 点口 + GetRandomPoint(GJot, jotList); + // 状态为已处理状态,但批段不关闭 + foreach (var g in jotList) + { + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(g.PointBatchItemId, true); + } + } + } + #endregion + + } + else + { + // 不点口,状态为变已处理,批段完成 + foreach (var q in jotList) + { + BLL.Batch_PointBatchItemService.UpdateIsCompletedPoint(q.PointBatchItemId, true); + BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(q.PointBatchItemId, true); + } + + } + } + } + } + else + { + ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning); + return; + } + } + + private void GetRandomPoint(List GJot, List jotList) + { + // 先查找固定口数量,如有固定口,则优先点 + if (GJot.Count() > 0) + { + int Gnum = GJot.Count(); + int rnum = Funs.GetRandomNum(1, Gnum); + int j = 1; + foreach (var g in GJot) + { + if (rnum == j) + { + BLL.Batch_PointBatchItemService.UpdatePointBatchItem(g.PointBatchItemId, "1", System.DateTime.Now, null); + } + j++; + } + } + else + { + if (jotList.Count() > 0) + { + int rnum = Funs.GetRandomNum(1, jotList.Count()); + int j = 1; + foreach (var g in jotList) + { + if (rnum == j) + { + BLL.Batch_PointBatchItemService.UpdatePointBatchItem(g.PointBatchItemId, "1", System.DateTime.Now, null); + } + j++; + } + } + } + } + + /// /// 手动结束批 /// @@ -1632,6 +1958,20 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage return newTrustCode; } + private class PointBatchList + { + public string PointBatchItemId + { + get; + set; + } + public string JointAttribute + { + get; + set; + } + } + } } \ No newline at end of file diff --git a/HJGL/FineUIPro.Web/WeldingProcess/TrustManage/PointManage.aspx.designer.cs b/HJGL/FineUIPro.Web/WeldingProcess/TrustManage/PointManage.aspx.designer.cs index 177199f..89e6ab3 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/TrustManage/PointManage.aspx.designer.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/TrustManage/PointManage.aspx.designer.cs @@ -203,6 +203,24 @@ namespace FineUIPro.Web.WeldingProcess.TrustManage /// protected global::FineUIPro.Button btnHandGenerate; + /// + /// Toolbar4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar4; + + /// + /// btnDailyCompPoint 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnDailyCompPoint; + /// /// btnbtnOpenResetPoint 控件。 /// diff --git a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx.cs b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx.cs index 1270f6c..9a2e25c 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx.cs @@ -102,13 +102,15 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage protected void BtnExtract_Click(object sender, EventArgs e) { - bool canWPS = true; - var jotList = (from x in Funs.DB.Pipeline_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId && x.WeldingDailyId != null && x.WeldingMethodId != null select x).ToList(); + var jotList = (from x in Funs.DB.Pipeline_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId && x.WeldingDailyId != null && x.WeldingMethodId != null + select x).ToList(); // && x.PipelineId== "246c6b8c-8fbd-480c-9810-43062bf09646" foreach (var jot in jotList) { var wps = BLL.WPQListServiceService.GetWPQById(jot.WPQId); string floorWelder = jot.BackingWelderId; string cellWelder = jot.CoverWelderId; + + bool canWPS = true; if (wps != null) { // 验证焊工WPS资质 @@ -143,7 +145,12 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage decimal? sch = jot.Thickness; string[] wmeCodes = mat.WeldingMethodCode.Split('+'); - string location = loc.WeldingLocationCode; + + string location=string.Empty; + if (loc != null) + { + location = loc.WeldingLocationCode; + } string ste = jot.Material1Id; List floorWelderQualifys = (from x in Funs.DB.Welder_WelderQualify @@ -201,13 +208,17 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage } } - - if (canWPS==false || canSave == false) + if (canWPS == false || canSave == false) { jot.IsSuperQueWelding = true; - Funs.DB.SubmitChanges(); + } - } + else + { + jot.IsSuperQueWelding = null; + } + } + Funs.DB.SubmitChanges(); ShowNotify("提取完成"); return; diff --git a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReport.aspx.cs b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReport.aspx.cs index b0f1878..aaf87cb 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReport.aspx.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReport.aspx.cs @@ -9,6 +9,7 @@ using NPOI.SS.Util; using NPOI.XSSF.UserModel; using System.Linq; using BLL; +using System.Web.Configuration; namespace FineUIPro.Web.WeldingProcess.WeldingManage { @@ -353,6 +354,11 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage var weldJoints = BLL.Pipeline_WeldJointService.GetWeldlinesByWeldingDailyId(weldingDailyId); if (weldJoints.Count() > 0) { + string[] jointList = weldJoints.Select(p => p.WeldJointId).ToArray(); + var pointBatchList = from x in Funs.DB.Batch_PointBatchItem + where jointList.Contains(x.WeldJointId) + select x; + string[] pointBatchIdList = pointBatchList.Select(p => p.PointBatchId).Distinct().ToArray(); foreach (var item in weldJoints) { var updateWeldJoint = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId); @@ -369,8 +375,42 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage BLL.Batch_NDEItemService.DeleteAllNDEInfoToWeldJoint(item.WeldJointId); } } + + // 打开批 + if (pointBatchIdList.Count() > 0) + { + foreach (string p in pointBatchIdList) + { + var pItem = (from x in Funs.DB.Batch_PointBatchItem + orderby x.EnterDate descending + where x.PointBatchId == p + select x).ToList(); + int pItemNum = pItem.Count(); + if (pItemNum > 0) + { + var batch = BLL.Batch_PointBatchService.GetPointBatchById(p); + var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(batch.DetectionRateId); + int dnum = Convert.ToInt32((double)100 / (int)rate.DetectionRateValue); + // 取模(余数) + int modelNum = pItemNum % dnum; + // 等于0不处理 + if (modelNum != 0) + { + var bachtOrder = pItem.GetRange(0, modelNum); + foreach (var g in bachtOrder) + { + BLL.Batch_PointBatchItemService.UpdatePointBatchOrder(g.PointBatchItemId, false); + } + } + } + } + } + } BLL.Pipeline_WeldingDailyService.DeleteWeldingDailyByWeldingDailyId(weldingDailyId); + + + BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_WeldReportMenuId, Const.BtnDelete, weldingDailyId); ShowNotify(Resources.Lan.DeletedSuccessfully, MessageBoxIcon.Success); this.BindGrid(); @@ -1019,6 +1059,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage // } //} + string oldmat1 = d.Material1Id; if (ds.Tables[0].Rows[i]["材质1"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["材质1"].ToString())) { var steel = materials.FirstOrDefault(x => x.MaterialCode == ds.Tables[0].Rows[i]["材质1"].ToString()); @@ -1050,7 +1091,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage else { if ((!string.IsNullOrEmpty(d.Material2Id) && steel.MaterialId != d.Material2Id) - && (!string.IsNullOrEmpty(d.Material1Id) && steel.MaterialId != d.Material1Id)) + && (!string.IsNullOrEmpty(oldmat1) && steel.MaterialId != oldmat1)) { errorInfos += (i + 2) + "行,材质2[" + ds.Tables[0].Rows[i]["材质2"].ToString() + "]验证不一至;"; } @@ -1061,7 +1102,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage } } - + string oldCom1 = d.PipeAssembly1Id; if (ds.Tables[0].Rows[i]["组件1"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["组件1"].ToString())) { var com = componentss.FirstOrDefault(x => x.ComponentsCode == ds.Tables[0].Rows[i]["组件1"].ToString()); @@ -1093,8 +1134,8 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage } else { - if ((!string.IsNullOrEmpty(d.PipeAssembly1Id) && com.ComponentsId != d.PipeAssembly1Id) - && (!string.IsNullOrEmpty(d.PipeAssembly2Id) && com.ComponentsId != d.PipeAssembly2Id)) + if ((!string.IsNullOrEmpty(d.PipeAssembly2Id) && com.ComponentsId != d.PipeAssembly2Id) + && (!string.IsNullOrEmpty(oldCom1) && com.ComponentsId != oldCom1)) { errorInfos += (i + 2) + "行,组件2[" + ds.Tables[0].Rows[i]["组件2"].ToString() + "]验证不一至;"; } @@ -1105,6 +1146,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage } } + string oldHeartNo1 = d.HeartNo1; if (ds.Tables[0].Rows[i]["炉批号1"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["炉批号1"].ToString())) { if ((!string.IsNullOrEmpty(d.HeartNo1) && ds.Tables[0].Rows[i]["炉批号1"].ToString() != d.HeartNo1) @@ -1120,7 +1162,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage if (ds.Tables[0].Rows[i]["炉批号2"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["炉批号2"].ToString())) { - if ((!string.IsNullOrEmpty(d.HeartNo1) && ds.Tables[0].Rows[i]["炉批号2"].ToString() != d.HeartNo1) + if ((!string.IsNullOrEmpty(oldHeartNo1) && ds.Tables[0].Rows[i]["炉批号2"].ToString() != oldHeartNo1) && (!string.IsNullOrEmpty(d.HeartNo2) && ds.Tables[0].Rows[i]["炉批号2"].ToString() != d.HeartNo2)) { errorInfos += (i + 2) + "行,炉批号2[" + ds.Tables[0].Rows[i]["炉批号2"].ToString() + "]验证不一至;"; diff --git a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReportEdit.aspx.cs b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReportEdit.aspx.cs index a5bc38c..56ba2f6 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReportEdit.aspx.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReportEdit.aspx.cs @@ -340,23 +340,30 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage var wps = BLL.WPQListServiceService.GetWPQById(item.WPQId); // 验证焊工资质 - if (item.BackingWelderId == item.CoverWelderId) + if (wps != null) { - if (!wps.WelderIds.Contains(item.BackingWelderId)) + if (item.BackingWelderId == item.CoverWelderId) { - errorCheck += rowIndex + "行,焊工:" + item.BackingWelderCode + "无WPS焊接资质,"; + if (!wps.WelderIds.Contains(item.BackingWelderId)) + { + errorCheck += rowIndex + "行,焊工:" + item.BackingWelderCode + "无WPS焊接资质,"; + } + } + else + { + if (!wps.WelderIds.Contains(item.BackingWelderId)) + { + errorCheck += rowIndex + "行,焊工:" + item.BackingWelderCode + "无WPS焊接资质,"; + } + if (!wps.WelderIds.Contains(item.CoverWelderId)) + { + errorCheck += rowIndex + "行,焊工:" + item.CoverWelderId + "无WPS焊接资质,"; + } } } else { - if (!wps.WelderIds.Contains(item.BackingWelderId)) - { - errorCheck += rowIndex + "行,焊工:" + item.BackingWelderCode + "无WPS焊接资质,"; - } - if (!wps.WelderIds.Contains(item.CoverWelderId)) - { - errorCheck += rowIndex + "行,焊工:" + item.CoverWelderId + "无WPS焊接资质,"; - } + errorCheck += rowIndex + "行,WPS不能为空,"; } // 验证数据是否一至 diff --git a/HJGL/FineUIPro.Web/WeldingProcess/WeldingReport/WeldDailyExport.aspx b/HJGL/FineUIPro.Web/WeldingProcess/WeldingReport/WeldDailyExport.aspx index bd51b5a..01fcda0 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/WeldingReport/WeldDailyExport.aspx +++ b/HJGL/FineUIPro.Web/WeldingProcess/WeldingReport/WeldDailyExport.aspx @@ -37,6 +37,9 @@ + + @@ -45,6 +48,15 @@ + + + + + + + + + @@ -53,15 +65,8 @@ - + - - - - - - - diff --git a/HJGL/FineUIPro.Web/WeldingProcess/WeldingReport/WeldDailyExport.aspx.cs b/HJGL/FineUIPro.Web/WeldingProcess/WeldingReport/WeldDailyExport.aspx.cs index 7c19c45..fd93eab 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/WeldingReport/WeldDailyExport.aspx.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/WeldingReport/WeldDailyExport.aspx.cs @@ -40,6 +40,13 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport drpTeamGroup.DataSource = teamGroup; drpTeamGroup.DataBind(); Funs.FineUIPleaseSelect(drpTeamGroup, ""); + + // 焊口属性 + this.drpJointAttribute.DataTextField = "Text"; + this.drpJointAttribute.DataValueField = "Value"; + this.drpJointAttribute.DataSource = BLL.DropListService.HJGL_JointAttributeItem(); + this.drpJointAttribute.DataBind(); + Funs.FineUIPleaseSelect(this.drpJointAttribute, Resources.Lan.PleaseSelect); } } @@ -103,6 +110,11 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport strSql += " AND pipeline.UnitId = @UnitId"; listStr.Add(new SqlParameter("@UnitId", drpUnit.SelectedValue)); } + if (this.drpJointAttribute.SelectedValue != Const._Null) + { + strSql += " AND weldJoint.JointAttribute = @JointAttribute"; + listStr.Add(new SqlParameter("@JointAttribute", drpJointAttribute.SelectedValue)); + } if (this.drpTeamGroup.SelectedValueArray.Length>0) { string[] teamGroupList = drpTeamGroup.SelectedValueArray; @@ -251,261 +263,294 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport } //批量审核 - - protected void btnAuditAll_Click(object sender,EventArgs e) + + protected void btnAuditAll_Click(object sender, EventArgs e) { - var data = this.GetDataTable(); - if (string.IsNullOrEmpty(txtStarTime.Text) && string.IsNullOrEmpty(txtEndTime.Text)) + if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.WeldDailyExportMenuId, Const.BtnAuditing)) { - ShowNotify("请按照日期选择要审核的日报!",MessageBoxIcon.Warning); + var data = this.GetDataTable(); + if (string.IsNullOrEmpty(txtStarTime.Text) && string.IsNullOrEmpty(txtEndTime.Text)) + { + ShowNotify("请按照日期选择要审核的日报!", MessageBoxIcon.Warning); + return; + } + List ids = new List(); + foreach (DataRow dr in data.Rows) + { + ids.Add(dr["WeldJointId"].ToString()); + } + ModifyAuditStatus(ids, 1); + this.BindGrid(); + ShowNotify("批量审核成功!", MessageBoxIcon.Success); + } + else + { + ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning); return; } - List ids = new List(); - foreach (DataRow dr in data.Rows) - { - ids.Add(dr["WeldJointId"].ToString()); - } - ModifyAuditStatus(ids, 1); - this.BindGrid(); - ShowNotify("批量审核成功!", MessageBoxIcon.Success); } //审核 - protected void btnAudit_Click(object sender,EventArgs e) + protected void btnAudit_Click(object sender, EventArgs e) { - var listIds = GetWeldJointIdList(); - if (listIds.Count == 0) + if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.WeldDailyExportMenuId, Const.BtnAuditing)) { - ShowNotify("请选择要审核的焊接日报数据", MessageBoxIcon.Warning); + var listIds = GetWeldJointIdList(); + if (listIds.Count == 0) + { + ShowNotify("请选择要审核的焊接日报数据", MessageBoxIcon.Warning); + return; + } + ModifyAuditStatus(listIds, 1); + this.BindGrid(); + + ShowNotify("批量审核成功!", MessageBoxIcon.Success); + } + else + { + ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning); return; } - ModifyAuditStatus(listIds,1); - this.BindGrid(); - - ShowNotify("批量审核成功!", MessageBoxIcon.Success); } + //取消审核 protected void btnCancel_Click(object sender, EventArgs e) { - var listIds = GetWeldJointIdList(); - if (listIds.Count == 0) + if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.WeldDailyExportMenuId, Const.BtnCancelAuditing)) { - ShowNotify("请选择要取消审核的焊接日报数据", MessageBoxIcon.Warning); + var listIds = GetWeldJointIdList(); + if (listIds.Count == 0) + { + ShowNotify("请选择要取消审核的焊接日报数据", MessageBoxIcon.Warning); + return; + } + ModifyAuditStatus(listIds, 0); + this.BindGrid(); + ShowNotify("批量取消审核成功!", MessageBoxIcon.Success); + } + else + { + ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning); return; } - ModifyAuditStatus(listIds,0); - this.BindGrid(); - ShowNotify("批量取消审核成功!", MessageBoxIcon.Success); } //发送邮件 - protected void btnSendEmail_Click(object sender,EventArgs e) + protected void btnSendEmail_Click(object sender, EventArgs e) { - DataTable dt = GetDataTableAuditStatus(); - if (dt.Rows.Count == 0) + if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.WeldDailyExportMenuId, Const.BtnSendEmail)) { - ShowNotify("暂无已审核的数据!",MessageBoxIcon.Warning); + DataTable dt = GetDataTableAuditStatus(); + if (dt.Rows.Count == 0) + { + ShowNotify("暂无已审核的数据!", MessageBoxIcon.Warning); + return; + } + string rootPath = Server.MapPath("~/") + Const.ExcelUrl; + //模板文件 + string TempletFileName = rootPath + "WeldDailyExport.xlsx"; + //导出文件 + string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; + if (!Directory.Exists(filePath)) + { + Directory.CreateDirectory(filePath); + } + string ReportFileName = filePath + $"焊接日报_{DateTime.Now.ToString("yyyyMMddhhmmss")}.xlsx"; + + try + { + FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read); + XSSFWorkbook hssfworkbook = new XSSFWorkbook(file); + + hssfworkbook.RemoveAt(0); + XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("Sheet1"); + + int rowIndex = 0; + var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 20, true, true, "Arial"); + + #region 头部 + ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex, style, 0, 19, true); + ws.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(rowIndex, rowIndex, 0, 19)); + //设置表头文字 + ws.GetRow(rowIndex).GetCell(0).SetCellValue("焊接日报表\nWelding Daily Report"); + var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, true, true, "Arial"); + + ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 2, style2, 0, 19, true); + //设置表格表头 + ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("序号"); + ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("管线号-页码"); + ws.GetRow(rowIndex + 1).GetCell(2).SetCellValue("图纸版本"); + ws.GetRow(rowIndex + 1).GetCell(3).SetCellValue("焊口号"); + ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue("焊接形式"); + ws.GetRow(rowIndex + 1).GetCell(5).SetCellValue("焊接位置"); + ws.GetRow(rowIndex + 1).GetCell(6).SetCellValue("寸径"); + ws.GetRow(rowIndex + 1).GetCell(7).SetCellValue("规格"); + ws.GetRow(rowIndex + 1).GetCell(8).SetCellValue("焊工号"); + ws.GetRow(rowIndex + 1).GetCell(9).SetCellValue("组对部件1"); + ws.GetRow(rowIndex + 1).GetCell(10).SetCellValue("组件1材质"); + ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue("组件1炉批号"); + ws.GetRow(rowIndex + 1).GetCell(12).SetCellValue("组对部件2"); + ws.GetRow(rowIndex + 1).GetCell(13).SetCellValue("组件2材质"); + ws.GetRow(rowIndex + 1).GetCell(14).SetCellValue("组件2炉批号"); + ws.GetRow(rowIndex + 1).GetCell(15).SetCellValue("焊接方法"); + ws.GetRow(rowIndex + 1).GetCell(16).SetCellValue("组对"); + ws.GetRow(rowIndex + 1).GetCell(17).SetCellValue("外观"); + ws.GetRow(rowIndex + 1).GetCell(18).SetCellValue("焊接日期"); + ws.GetRow(rowIndex + 1).GetCell(19).SetCellValue("备注"); + + ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("S/N"); + ws.GetRow(rowIndex + 2).GetCell(1).SetCellValue("LineNo.-PageNo."); + ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue("Drawing\nRev"); + ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue("Joint\nNo."); + ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue("JointType"); + ws.GetRow(rowIndex + 2).GetCell(5).SetCellValue("Welding\nLocation"); + ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("Inch"); + ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("Size"); + ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("Welder\nNo."); + ws.GetRow(rowIndex + 2).GetCell(9).SetCellValue("Part(1)"); + ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue("Material(1)"); + ws.GetRow(rowIndex + 2).GetCell(11).SetCellValue("Heat\nNo.(1)"); + ws.GetRow(rowIndex + 2).GetCell(12).SetCellValue("Part(2)"); + ws.GetRow(rowIndex + 2).GetCell(13).SetCellValue("Material(2)"); + ws.GetRow(rowIndex + 2).GetCell(14).SetCellValue("Heat\nNo.(2)"); + ws.GetRow(rowIndex + 2).GetCell(15).SetCellValue("Weld\nProcess"); + ws.GetRow(rowIndex + 2).GetCell(16).SetCellValue("Fit\nUp"); + ws.GetRow(rowIndex + 2).GetCell(17).SetCellValue("VT"); + ws.GetRow(rowIndex + 2).GetCell(18).SetCellValue("Welding\nDate"); + ws.GetRow(rowIndex + 2).GetCell(19).SetCellValue("Remark"); + + ws.GetRow(rowIndex).Height = 69 * 20; + ws.GetRow(rowIndex + 1).Height = 15 * 20; + ws.GetRow(rowIndex + 2).Height = 30 * 20; + + ws.SetColumnWidth(0, 5 * 256); + ws.SetColumnWidth(1, (int)(21.67 * 256)); + ws.SetColumnWidth(2, (int)(9.78 * 256)); + ws.SetColumnWidth(3, (int)(5.33 * 256)); + ws.SetColumnWidth(4, (int)(7.67 * 256)); + ws.SetColumnWidth(5, (int)(8.33 * 256)); + ws.SetColumnWidth(6, (int)(7 * 256)); + ws.SetColumnWidth(7, (int)(10.82 * 256)); + ws.SetColumnWidth(8, (int)(8.33 * 256)); + ws.SetColumnWidth(9, (int)(8.40 * 256)); + ws.SetColumnWidth(10, (int)(15.67 * 256)); + ws.SetColumnWidth(11, (int)(12 * 256)); + ws.SetColumnWidth(12, (int)(8.22 * 256)); + ws.SetColumnWidth(13, (int)(16.33 * 256)); + ws.SetColumnWidth(14, (int)(11.45 * 256)); + ws.SetColumnWidth(15, (int)(11.00 * 256)); + ws.SetColumnWidth(16, (int)(4.00 * 256)); + ws.SetColumnWidth(17, (int)(4.00 * 256)); + ws.SetColumnWidth(18, (int)(9.00 * 256)); + ws.SetColumnWidth(19, (int)(7 * 256)); + #endregion + + const int pageSize = 65; + + var style3 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, false, false, "sans-serif"); + + ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 3, dt.Rows.Count + 2, style3, 0, 19); + for (int i = 0; i < dt.Rows.Count; i++) + { + int startIndex = (i + 3); + ws.GetRow(startIndex).GetCell(0).SetCellValue(i + 1); + ws.GetRow(startIndex).GetCell(1).SetCellValue(dt.Rows[i]["SingleNumber"].ToString()); + ws.GetRow(startIndex).GetCell(2).SetCellValue(dt.Rows[i]["DrawingsNum"].ToString()); + ws.GetRow(startIndex).GetCell(3).SetCellValue(dt.Rows[i]["WeldJointCode"].ToString()); + ws.GetRow(startIndex).GetCell(4).SetCellValue(dt.Rows[i]["WeldTypeCode"].ToString()); + ws.GetRow(startIndex).GetCell(5).SetCellValue(dt.Rows[i]["WeldingLocationCode"].ToString()); + ws.GetRow(startIndex).GetCell(6).SetCellValue(dt.Rows[i]["Size"].ToString()); + ws.GetRow(startIndex).GetCell(7).SetCellValue(dt.Rows[i]["Specification"].ToString()); + ws.GetRow(startIndex).GetCell(8).SetCellValue(dt.Rows[i]["WelderCode"].ToString()); + ws.GetRow(startIndex).GetCell(9).SetCellValue(dt.Rows[i]["ComponentsName1"].ToString()); + ws.GetRow(startIndex).GetCell(10).SetCellValue(dt.Rows[i]["MaterialCode1"].ToString()); + ws.GetRow(startIndex).GetCell(11).SetCellValue(dt.Rows[i]["HeartNo1"].ToString()); + ws.GetRow(startIndex).GetCell(12).SetCellValue(dt.Rows[i]["ComponentsName2"].ToString()); + ws.GetRow(startIndex).GetCell(13).SetCellValue(dt.Rows[i]["MaterialCode2"].ToString()); + ws.GetRow(startIndex).GetCell(14).SetCellValue(dt.Rows[i]["HeartNo2"].ToString()); + ws.GetRow(startIndex).GetCell(15).SetCellValue(dt.Rows[i]["WeldingMethodName"].ToString()); + ws.GetRow(startIndex).GetCell(16).SetCellValue("ACC"); + ws.GetRow(startIndex).GetCell(17).SetCellValue("ACC"); + ws.GetRow(startIndex).GetCell(18).SetCellValue(dt.Rows[i]["WeldingDate"].ToString()); + ws.GetRow(startIndex).GetCell(19).SetCellValue(dt.Rows[i]["Remark"].ToString()); + ws.GetRow(startIndex).Height = 10 * 20; + if (startIndex == pageSize) + { + ws.SetRowBreak(startIndex); + startIndex += pageSize; + } + } + + if (dt.Rows.Count > 0) + { + string weldingDate = string.Empty; + if (txtStarTime.Text == txtEndTime.Text) + { + weldingDate = txtStarTime.Text; + } + else + { + weldingDate = txtStarTime.Text + "-" + txtEndTime.Text; + } + var style4 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, true, true, "Arial"); + + ws = ExcelCreateRow(ws, hssfworkbook, dt.Rows.Count + 3, dt.Rows.Count + 3, style4, 0, 19); + var distinctPipelineCode = dt.AsEnumerable().GroupBy(row => row.Field("PipelineCode")).Select(group => group.First()); + var distinctWelder = dt.AsEnumerable().GroupBy(row => row.Field("WelderCode")).Select(group => group.First()); + decimal sumSize = decimal.Parse(dt.Compute("sum(Size)", "").ToString()); + + ws.GetRow(dt.Rows.Count + 3).GetCell(0).SetCellValue("Total"); + ws.GetRow(dt.Rows.Count + 3).GetCell(1).SetCellValue($"{distinctPipelineCode.Count().ToString()}"); + ws.GetRow(dt.Rows.Count + 3).GetCell(3).SetCellValue($"{dt.Rows.Count}"); + ws.GetRow(dt.Rows.Count + 3).GetCell(6).SetCellValue($"{sumSize}"); + ws.GetRow(dt.Rows.Count + 3).GetCell(8).SetCellValue($"{distinctWelder.Count().ToString()}"); + ws.GetRow(dt.Rows.Count + 3).Height = 20 * 20; + + + + } + + #region 页脚部分 + IFooter footer = ws.Footer; + string str = " CC7: 监理: Worley:"; + str += "\n\n第 &P 页,共 &N 页"; + footer.Center = str; + + + #endregion + + ws.FitToPage = true; + ws.PrintSetup.FitWidth = 1; + ws.PrintSetup.FitHeight = short.MaxValue; + + ws.SetMargin(MarginType.LeftMargin, (double)1.2 / 3); + ws.SetMargin(MarginType.RightMargin, (double)0.5 / 3); + ws.SetMargin(MarginType.TopMargin, (double)1.8 / 3); + ws.SetMargin(MarginType.BottomMargin, (double)2.9 / 3); + ws.PrintSetup.Landscape = true; + ws.ForceFormulaRecalculation = true; + ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small; + ws.RepeatingRows = new NPOI.SS.Util.CellRangeAddress(0, 2, 0, 19); + + using (FileStream filess = System.IO.File.OpenWrite(ReportFileName)) + { + hssfworkbook.Write(filess); + } + hssfworkbook.Close(); + + this.GetEmailTemplateAndSendEmail(ReportFileName); + File.Delete(ReportFileName); + ShowNotify("焊接日报发送成功!", MessageBoxIcon.Success); + } + catch (Exception ex) + { + ShowNotify($"发送失败,原因:{ex.Message}", MessageBoxIcon.Error); + } + } + else + { + ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning); return; } - string rootPath = Server.MapPath("~/") + Const.ExcelUrl; - //模板文件 - string TempletFileName = rootPath + "WeldDailyExport.xlsx"; - //导出文件 - string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; - if (!Directory.Exists(filePath)) - { - Directory.CreateDirectory(filePath); - } - string ReportFileName = filePath + $"焊接日报_{DateTime.Now.ToString("yyyyMMddhhmmss")}.xlsx"; - - try - { - FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read); - XSSFWorkbook hssfworkbook = new XSSFWorkbook(file); - - hssfworkbook.RemoveAt(0); - XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("Sheet1"); - - int rowIndex = 0; - var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 20, true, true, "微软雅黑"); - - #region 头部 - ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex, style, 0, 19, true); - ws.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(rowIndex, rowIndex, 0, 19)); - //设置表头文字 - ws.GetRow(rowIndex).GetCell(0).SetCellValue("焊接日报表\nWelding Daily Report"); - var style2 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, true, true, "Arial"); - - ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 1, rowIndex + 2, style2, 0, 19, true); - //设置表格表头 - ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("序号"); - ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("管线号-页码"); - ws.GetRow(rowIndex + 1).GetCell(2).SetCellValue("图纸版本"); - ws.GetRow(rowIndex + 1).GetCell(3).SetCellValue("焊口号"); - ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue("焊接形式"); - ws.GetRow(rowIndex + 1).GetCell(5).SetCellValue("焊接位置"); - ws.GetRow(rowIndex + 1).GetCell(6).SetCellValue("寸径"); - ws.GetRow(rowIndex + 1).GetCell(7).SetCellValue("规格"); - ws.GetRow(rowIndex + 1).GetCell(8).SetCellValue("焊工号"); - ws.GetRow(rowIndex + 1).GetCell(9).SetCellValue("组对部件1"); - ws.GetRow(rowIndex + 1).GetCell(10).SetCellValue("组件1材质"); - ws.GetRow(rowIndex + 1).GetCell(11).SetCellValue("组件1炉批号"); - ws.GetRow(rowIndex + 1).GetCell(12).SetCellValue("组对部件2"); - ws.GetRow(rowIndex + 1).GetCell(13).SetCellValue("组件2材质"); - ws.GetRow(rowIndex + 1).GetCell(14).SetCellValue("组件2炉批号"); - ws.GetRow(rowIndex + 1).GetCell(15).SetCellValue("焊接方法"); - ws.GetRow(rowIndex + 1).GetCell(16).SetCellValue("组对"); - ws.GetRow(rowIndex + 1).GetCell(17).SetCellValue("外观"); - ws.GetRow(rowIndex + 1).GetCell(18).SetCellValue("焊接日期"); - ws.GetRow(rowIndex + 1).GetCell(19).SetCellValue("备注"); - - ws.GetRow(rowIndex + 2).GetCell(0).SetCellValue("S/N"); - ws.GetRow(rowIndex + 2).GetCell(1).SetCellValue("LineNo.-PageNo."); - ws.GetRow(rowIndex + 2).GetCell(2).SetCellValue("Drawing\nRev"); - ws.GetRow(rowIndex + 2).GetCell(3).SetCellValue("Joint\nNo."); - ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue("JointType"); - ws.GetRow(rowIndex + 2).GetCell(5).SetCellValue("Welding\nLocation"); - ws.GetRow(rowIndex + 2).GetCell(6).SetCellValue("Inch"); - ws.GetRow(rowIndex + 2).GetCell(7).SetCellValue("Size"); - ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("Welder\nNo."); - ws.GetRow(rowIndex + 2).GetCell(9).SetCellValue("Part(1)"); - ws.GetRow(rowIndex + 2).GetCell(10).SetCellValue("Material(1)"); - ws.GetRow(rowIndex + 2).GetCell(11).SetCellValue("Heat\nNo.(1)"); - ws.GetRow(rowIndex + 2).GetCell(12).SetCellValue("Part(2)"); - ws.GetRow(rowIndex + 2).GetCell(13).SetCellValue("Material(2)"); - ws.GetRow(rowIndex + 2).GetCell(14).SetCellValue("Heat\nNo.(2)"); - ws.GetRow(rowIndex + 2).GetCell(15).SetCellValue("Weld\nProcess"); - ws.GetRow(rowIndex + 2).GetCell(16).SetCellValue("Fit\nUp"); - ws.GetRow(rowIndex + 2).GetCell(17).SetCellValue("VT"); - ws.GetRow(rowIndex + 2).GetCell(18).SetCellValue("Welding\nDate"); - ws.GetRow(rowIndex + 2).GetCell(19).SetCellValue("Remark"); - - ws.GetRow(rowIndex).Height = 69 * 20; - ws.GetRow(rowIndex + 1).Height = 15 * 20; - ws.GetRow(rowIndex + 2).Height = 30 * 20; - - ws.SetColumnWidth(0, 5 * 256); - ws.SetColumnWidth(1, (int)(21.67 * 256)); - ws.SetColumnWidth(2, (int)(9.78 * 256)); - ws.SetColumnWidth(3, (int)(5.33 * 256)); - ws.SetColumnWidth(4, (int)(7.67 * 256)); - ws.SetColumnWidth(5, (int)(8.33 * 256)); - ws.SetColumnWidth(6, (int)(7 * 256)); - ws.SetColumnWidth(7, (int)(10.82 * 256)); - ws.SetColumnWidth(8, (int)(8.33 * 256)); - ws.SetColumnWidth(9, (int)(8.40 * 256)); - ws.SetColumnWidth(10, (int)(15.67 * 256)); - ws.SetColumnWidth(11, (int)(12 * 256)); - ws.SetColumnWidth(12, (int)(8.22 * 256)); - ws.SetColumnWidth(13, (int)(16.33 * 256)); - ws.SetColumnWidth(14, (int)(11.45 * 256)); - ws.SetColumnWidth(15, (int)(11.00 * 256)); - ws.SetColumnWidth(16, (int)(4.00 * 256)); - ws.SetColumnWidth(17, (int)(4.00 * 256)); - ws.SetColumnWidth(18, (int)(9.00 * 256)); - ws.SetColumnWidth(19, (int)(7 * 256)); - #endregion - - const int pageSize = 65; - - var style3 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, false, false, "sans-serif"); - - ws = ExcelCreateRow(ws, hssfworkbook, rowIndex + 3, dt.Rows.Count + 2, style3, 0, 19); - for (int i = 0; i < dt.Rows.Count; i++) - { - int startIndex = (i + 3); - ws.GetRow(startIndex).GetCell(0).SetCellValue(i + 1); - ws.GetRow(startIndex).GetCell(1).SetCellValue(dt.Rows[i]["SingleNumber"].ToString()); - ws.GetRow(startIndex).GetCell(2).SetCellValue(dt.Rows[i]["DrawingsNum"].ToString()); - ws.GetRow(startIndex).GetCell(3).SetCellValue(dt.Rows[i]["WeldJointCode"].ToString()); - ws.GetRow(startIndex).GetCell(4).SetCellValue(dt.Rows[i]["WeldTypeCode"].ToString()); - ws.GetRow(startIndex).GetCell(5).SetCellValue(dt.Rows[i]["WeldingLocationCode"].ToString()); - ws.GetRow(startIndex).GetCell(6).SetCellValue(dt.Rows[i]["Size"].ToString()); - ws.GetRow(startIndex).GetCell(7).SetCellValue(dt.Rows[i]["Specification"].ToString()); - ws.GetRow(startIndex).GetCell(8).SetCellValue(dt.Rows[i]["WelderCode"].ToString()); - ws.GetRow(startIndex).GetCell(9).SetCellValue(dt.Rows[i]["ComponentsName1"].ToString()); - ws.GetRow(startIndex).GetCell(10).SetCellValue(dt.Rows[i]["MaterialCode1"].ToString()); - ws.GetRow(startIndex).GetCell(11).SetCellValue(dt.Rows[i]["HeartNo1"].ToString()); - ws.GetRow(startIndex).GetCell(12).SetCellValue(dt.Rows[i]["ComponentsName2"].ToString()); - ws.GetRow(startIndex).GetCell(13).SetCellValue(dt.Rows[i]["MaterialCode2"].ToString()); - ws.GetRow(startIndex).GetCell(14).SetCellValue(dt.Rows[i]["HeartNo2"].ToString()); - ws.GetRow(startIndex).GetCell(15).SetCellValue(dt.Rows[i]["WeldingMethodName"].ToString()); - ws.GetRow(startIndex).GetCell(16).SetCellValue("ACC"); - ws.GetRow(startIndex).GetCell(17).SetCellValue("ACC"); - ws.GetRow(startIndex).GetCell(18).SetCellValue(dt.Rows[i]["WeldingDate"].ToString()); - ws.GetRow(startIndex).GetCell(19).SetCellValue(dt.Rows[i]["Remark"].ToString()); - ws.GetRow(startIndex).Height = 10 * 20; - if (startIndex == pageSize) - { - ws.SetRowBreak(startIndex); - startIndex += pageSize; - } - } - - if (dt.Rows.Count > 0) - { - string weldingDate = string.Empty; - if (txtStarTime.Text == txtEndTime.Text) - { - weldingDate = txtStarTime.Text; - } - else - { - weldingDate = txtStarTime.Text + "-" + txtEndTime.Text; - } - var style4 = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 9, true, true, "Arial"); - - ws = ExcelCreateRow(ws, hssfworkbook, dt.Rows.Count + 3, dt.Rows.Count + 3, style4, 0, 19); - var distinctPipelineCode = dt.AsEnumerable().GroupBy(row => row.Field("PipelineCode")).Select(group => group.First()); - var distinctWelder = dt.AsEnumerable().GroupBy(row => row.Field("WelderCode")).Select(group => group.First()); - decimal sumSize = decimal.Parse(dt.Compute("sum(Size)", "").ToString()); - - ws.GetRow(dt.Rows.Count + 3).GetCell(0).SetCellValue("Total"); - ws.GetRow(dt.Rows.Count + 3).GetCell(1).SetCellValue($"{distinctPipelineCode.Count().ToString()}"); - ws.GetRow(dt.Rows.Count + 3).GetCell(3).SetCellValue($"{dt.Rows.Count}"); - ws.GetRow(dt.Rows.Count + 3).GetCell(6).SetCellValue($"{sumSize}"); - ws.GetRow(dt.Rows.Count + 3).GetCell(8).SetCellValue($"{distinctWelder.Count().ToString()}"); - ws.GetRow(dt.Rows.Count + 3).Height = 20 * 20; - - - - } - - #region 页脚部分 - IFooter footer = ws.Footer; - string str = " CC7: 监理: Worley:"; - str += "\n\n第 &P 页,共 &N 页"; - footer.Center = str; - - - #endregion - - ws.FitToPage = true; - ws.PrintSetup.FitWidth = 1; - ws.PrintSetup.FitHeight = short.MaxValue; - - ws.SetMargin(MarginType.LeftMargin, (double)1.2 / 3); - ws.SetMargin(MarginType.RightMargin, (double)0.5 / 3); - ws.SetMargin(MarginType.TopMargin, (double)1.8 / 3); - ws.SetMargin(MarginType.BottomMargin, (double)2.9 / 3); - ws.PrintSetup.Landscape = true; - ws.ForceFormulaRecalculation = true; - ws.PrintSetup.PaperSize = (int)PaperSize.A4_Small; - ws.RepeatingRows = new NPOI.SS.Util.CellRangeAddress(0, 2, 0, 19); - - using (FileStream filess = System.IO.File.OpenWrite(ReportFileName)) - { - hssfworkbook.Write(filess); - } - hssfworkbook.Close(); - - this.GetEmailTemplateAndSendEmail(ReportFileName); - File.Delete(ReportFileName); - ShowNotify("焊接日报发送成功!", MessageBoxIcon.Success); - } - catch (Exception ex) - { - ShowNotify($"发送失败,原因:{ex.Message}", MessageBoxIcon.Error); - } } protected void Window1_Close(object sender, EventArgs e) { @@ -580,7 +625,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("Sheet1"); int rowIndex = 0; - var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 20, true, true, "微软雅黑"); + var style = CommonPrint.SetExcelStyle(hssfworkbook, BorderStyle.None, BorderStyle.None, BorderStyle.None, BorderStyle.None, VerticalAlignment.Center, NPOI.SS.UserModel.HorizontalAlignment.Center, 20, true, true, "Arial"); #region 头部 ws = ExcelCreateRow(ws, hssfworkbook, rowIndex, rowIndex, style, 0, 19, true); diff --git a/HJGL/FineUIPro.Web/WeldingProcess/WeldingReport/WeldDailyExport.aspx.designer.cs b/HJGL/FineUIPro.Web/WeldingProcess/WeldingReport/WeldDailyExport.aspx.designer.cs index a78108c..8c95238 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/WeldingReport/WeldDailyExport.aspx.designer.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/WeldingReport/WeldDailyExport.aspx.designer.cs @@ -86,6 +86,15 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport /// protected global::FineUIPro.DropDownList drpUnit; + /// + /// drpJointAttribute 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpJointAttribute; + /// /// drpTeamGroup 控件。 /// @@ -104,6 +113,24 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport /// protected global::FineUIPro.DropDownList drpAudit; + /// + /// ToolbarFill1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + /// /// txtStarTime 控件。 /// @@ -132,22 +159,13 @@ namespace FineUIPro.Web.WeldingProcess.WeldingReport protected global::FineUIPro.DatePicker txtEndTime; /// - /// ToolbarFill1 控件。 + /// ToolbarFill2 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.ToolbarFill ToolbarFill1; - - /// - /// Toolbar2 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Toolbar Toolbar2; + protected global::FineUIPro.ToolbarFill ToolbarFill2; /// /// BtnAnalyse 控件。 diff --git a/HJGL/Model/Model.cs b/HJGL/Model/Model.cs index cda10b9..f4b09f4 100644 --- a/HJGL/Model/Model.cs +++ b/HJGL/Model/Model.cs @@ -29,6 +29,10 @@ namespace Model #region 可扩展性方法定义 partial void OnCreated(); + partial void OnCreated() + { + this.CommandTimeout = 600; + } partial void InsertAttachFile(AttachFile instance); partial void UpdateAttachFile(AttachFile instance); partial void DeleteAttachFile(AttachFile instance); @@ -11772,7 +11776,7 @@ namespace Model private string _RepairRecordId; - private System.Nullable _BatchOrder; + private System.Nullable _BatchOrder; private System.Nullable _IsCompletedPoint; @@ -11782,6 +11786,8 @@ namespace Model private string _QTAudit; + private System.Nullable _EnterDate; + private EntitySet _Batch_BatchTrustItem; private EntityRef _Pipeline_WeldJoint; @@ -11832,7 +11838,7 @@ namespace Model partial void OnIsAuditChanged(); partial void OnRepairRecordIdChanging(string value); partial void OnRepairRecordIdChanged(); - partial void OnBatchOrderChanging(System.Nullable value); + partial void OnBatchOrderChanging(System.Nullable value); partial void OnBatchOrderChanged(); partial void OnIsCompletedPointChanging(System.Nullable value); partial void OnIsCompletedPointChanged(); @@ -11842,6 +11848,8 @@ namespace Model partial void OnGLGSAuditChanged(); partial void OnQTAuditChanging(string value); partial void OnQTAuditChanged(); + partial void OnEnterDateChanging(System.Nullable value); + partial void OnEnterDateChanged(); #endregion public Batch_PointBatchItem() @@ -12260,8 +12268,8 @@ namespace Model } } - [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BatchOrder", DbType="Int")] - public System.Nullable BatchOrder + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BatchOrder", DbType="Bit")] + public System.Nullable BatchOrder { get { @@ -12360,6 +12368,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EnterDate", DbType="DateTime")] + public System.Nullable EnterDate + { + get + { + return this._EnterDate; + } + set + { + if ((this._EnterDate != value)) + { + this.OnEnterDateChanging(value); + this.SendPropertyChanging(); + this._EnterDate = value; + this.SendPropertyChanged("EnterDate"); + this.OnEnterDateChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Batch_BatchTrustItem_Batch_PointBatchItem", Storage="_Batch_BatchTrustItem", ThisKey="PointBatchItemId", OtherKey="PointBatchItemId", DeleteRule="NO ACTION")] public EntitySet Batch_BatchTrustItem { diff --git a/HJGL/WebApi/WebApi.csproj.user b/HJGL/WebApi/WebApi.csproj.user index 6db81e9..33091aa 100644 --- a/HJGL/WebApi/WebApi.csproj.user +++ b/HJGL/WebApi/WebApi.csproj.user @@ -8,7 +8,7 @@ - Debug|Any CPU + Release|Any CPU FolderProfile diff --git a/HJGL/WebApi/obj/Release/WebApi.csproj.AssemblyReference.cache b/HJGL/WebApi/obj/Release/WebApi.csproj.AssemblyReference.cache index f42f14d..e1e5b4e 100644 Binary files a/HJGL/WebApi/obj/Release/WebApi.csproj.AssemblyReference.cache and b/HJGL/WebApi/obj/Release/WebApi.csproj.AssemblyReference.cache differ