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/.vs/HJGL/v17/.suo b/HJGL/.vs/HJGL/v17/.suo index 5f48b35..9bd2582 100644 Binary files a/HJGL/.vs/HJGL/v17/.suo and b/HJGL/.vs/HJGL/v17/.suo differ 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 baa8804..8868ed3 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 3b1f1cb..6e5eed5 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx +++ b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx @@ -117,6 +117,9 @@ + + @@ -144,11 +147,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 6c1976c..917d8a9 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.cs @@ -4,10 +4,9 @@ using System.Collections.Generic; using System.Data.SqlClient; using System.Data; using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using static System.Windows.Forms.VisualStyles.VisualStyleElement; +using NPOI.SS.UserModel; +using NPOI.XSSF.UserModel; + namespace FineUIPro.Web.WeldingProcess.PMI { @@ -384,6 +383,176 @@ namespace FineUIPro.Web.WeldingProcess.PMI #endregion #endregion + protected void btnExport_Click(object sender, EventArgs e) + { + Alert.ShowInTop("待开发!", MessageBoxIcon.Warning); + return; + //if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_BatchTrustMenuId, Const.BtnOut)) + //{ + + // 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(); + } + + /// + /// 无损检测委托单行和列 + /// + /// + private XSSFSheet WsExcelCreateRow(XSSFSheet ws, XSSFWorkbook hssfworkbook, int sRows, int eRows, ICellStyle style, int cStart, int cEnd, int excelpart, bool isnobk = false) + { + for (int i = sRows; i <= eRows; i++) + { + ws.CreateRow(i); + if (excelpart == 1) + { + ws.GetRow(i).HeightInPoints = + i == sRows ? 27.75f : + i == (sRows + 1) ? 25.5f : + i == (sRows + 2) ? 25.5f : + i == (sRows + 3) ? 25.5f : + i == (sRows + 4) ? 23.25f : + i == (sRows + 5) ? 23.25f : + i == (sRows + 6) ? 23.25f : + i == (sRows + 7) ? 23.25f : + i == (sRows + 8) ? 23.25f : + i == (sRows + 9) ? 23.25f : + i == (sRows + 10) ? 23.25f : + i == (sRows + 11) ? 23.25f : + i == (sRows + 12) ? 23.25f : + 17f; + } + else if (excelpart == 2) + { + + ws.GetRow(i).HeightInPoints = 25.5f; + } + else + { + ws.GetRow(i).HeightInPoints = 15.5f; + } + for (int j = cStart; j <= cEnd; j++) + { + 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.5, true, false); + } + else + { + ws.GetRow(i).GetCell(j).CellStyle = style; + } + } + } + return ws; + } + + /// + /// 材料及配件检测委托单行和列 + /// + /// + private XSSFSheet ClExcelCreateRow(XSSFSheet ws, XSSFWorkbook hssfworkbook, int sRows, int eRows, ICellStyle style, int cStart, int cEnd, bool istitle = false, bool isnobk = false) + { + for (int i = sRows; i <= eRows; i++) + { + ws.CreateRow(i); + if (istitle) + { + ws.GetRow(i).HeightInPoints = + i == sRows ? 27.75f : + i == (sRows + 1) ? 25f : + i == (sRows + 2) ? 21.75f : + i == (sRows + 3) ? 21.75f : + i == (sRows + 5) ? 28f : + 14.75f; + } + else + { + ws.GetRow(i).HeightInPoints = 14.75f; + } + for (int j = cStart; j <= cEnd; j++) + { + ws.GetRow(i).CreateCell(j); + if (isnobk) + { + 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 + { + ws.GetRow(i).GetCell(j).CellStyle = style; + } + } + } + return ws; + } + + /// + /// 查询指定条数分页 + /// + /// + public static DataTable GetPageToTable(DataTable dt, int StartNum, int EndNum) + { + //0页代表每页数据,直接返回 + if (EndNum == 0) return dt; + //数据源为空返回空DataTable + if (dt == null) return new DataTable(); + + DataTable newdt = dt.Copy(); + newdt.Clear();//copy dt的框架 + + if (StartNum >= dt.Rows.Count) + return newdt;//源数据记录数小于等于要显示的记录,直接返回dt + + if (EndNum > dt.Rows.Count) + EndNum = dt.Rows.Count; + for (int i = StartNum; i <= EndNum - 1; i++) + { + DataRow newdr = newdt.NewRow(); + DataRow dr = dt.Rows[i]; + foreach (DataColumn column in dt.Columns) + { + newdr[column.ColumnName] = dr[column.ColumnName]; + } + newdt.Rows.Add(newdr); + } + return newdt; + } + + #endregion + #region 获取按钮权限 /// /// 获取按钮权限 diff --git a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.designer.cs b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.designer.cs index 420aa75..ebdff89 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.designer.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/PMI/PMIDelegation.aspx.designer.cs @@ -257,6 +257,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 f18224c..8042d3b 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