From 453d1d5a3b37a577ad9fe4659bcfc9df6db2af33 Mon Sep 17 00:00:00 2001
From: fei550 <1420031550@qq.com>
Date: Tue, 21 Apr 2026 19:37:20 +0800
Subject: [PATCH] =?UTF-8?q?fix(print):=20=E9=81=BF=E5=85=8D=20FastReport?=
=?UTF-8?q?=20=E6=A8=A1=E6=9D=BF=E9=87=8D=E5=A4=8D=E5=86=99=E5=85=A5=20?=
=?UTF-8?q?=E4=BB=85=E5=9C=A8=E6=8A=A5=E8=A1=A8=E8=BF=9E=E6=8E=A5=E4=B8=B2?=
=?UTF-8?q?=E4=B8=8E=E7=B3=BB=E7=BB=9F=E8=BF=9E=E6=8E=A5=E4=B8=B2=E4=B8=8D?=
=?UTF-8?q?=E4=B8=80=E8=87=B4=E6=97=B6=E6=89=8D=E6=9B=B4=E6=96=B0=E5=B9=B6?=
=?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=A8=A1=E6=9D=BF=EF=BC=8C=20=E5=90=8C?=
=?UTF-8?q?=E6=97=B6=E5=A2=9E=E5=8A=A0=E6=A8=A1=E6=9D=BF=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E5=AD=98=E5=9C=A8=E6=80=A7=E6=A0=A1=E9=AA=8C=EF=BC=8C=E5=87=8F?=
=?UTF-8?q?=E5=B0=91=E6=89=93=E5=8D=B0=E6=97=B6=E5=9B=A0=E6=A8=A1=E6=9D=BF?=
=?UTF-8?q?=E6=96=87=E4=BB=B6=E5=BC=82=E5=B8=B8=E5=AF=BC=E8=87=B4=E7=9A=84?=
=?UTF-8?q?=E6=8A=A5=E9=94=99=E3=80=82=202.=E4=BF=AE=E5=A4=8D=E6=97=A0?=
=?UTF-8?q?=E6=8D=9F=E6=A3=80=E6=B5=8B=E5=A7=94=E6=89=98=E5=8D=95=E7=94=9F?=
=?UTF-8?q?=E6=88=90=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
SGGL/BLL/API/HJGL/APINDETrustService.cs | 2590 ++++++++---------
.../FineUIPro.Web/Controls/Fastreport.aspx.cs | 14 +-
2 files changed, 1306 insertions(+), 1298 deletions(-)
diff --git a/SGGL/BLL/API/HJGL/APINDETrustService.cs b/SGGL/BLL/API/HJGL/APINDETrustService.cs
index 6d9b39a9..1f02b976 100644
--- a/SGGL/BLL/API/HJGL/APINDETrustService.cs
+++ b/SGGL/BLL/API/HJGL/APINDETrustService.cs
@@ -1,409 +1,409 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace BLL
-{
- public static class APINDETrustService
- {
- #region 根据单位工程、项目Id获取未点口的批
- ///
- /// 根据单位工程、项目Id获取未点口的批
- ///
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace BLL
+{
+ public static class APINDETrustService
+ {
+ #region 根据单位工程、项目Id获取未点口的批
+ ///
+ /// 根据单位工程、项目Id获取未点口的批
+ ///
/// 单位工程Id
- /// 项目Id
- ///
- public static List getNotEndPointBatch(string unitWorkId, string projectId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- //var notTrustDataList = from x in db.HJGL_Batch_PointBatch
- // where x.UnitWorkId == unitWorkId && x.EndDate != null && x.ProjectId == projectId
- // && (from y in db.HJGL_Batch_BatchTrustItem
- // join z in db.HJGL_Batch_PointBatchItem on y.PointBatchItemId equals z.PointBatchItemId
- // where z.PointBatchId == x.PointBatchId
- // select y).Count() == 0
- // select x;
- //var dataList = from x in db.HJGL_Batch_PointBatch
- // where x.UnitWorkId == unitWorkId && x.EndDate == null && x.ProjectId == projectId
- // select x;
- var dataList = from x in db.HJGL_Batch_PointBatch
- where x.UnitWorkId == unitWorkId && x.ProjectId == projectId
- && (x.EndDate == null || (from y in db.HJGL_Batch_BatchTrustItem
- join z in db.HJGL_Batch_PointBatchItem on y.PointBatchItemId equals z.PointBatchItemId
- where z.PointBatchId == x.PointBatchId
- select y).Count() == 0)
- select x;
- var getDataLists = (from x in dataList
- orderby x.PointBatchCode
- select new Model.NDETrustItem
- {
- PointBatchId = x.PointBatchId,
- PointBatchCode = x.PointBatchCode,
- }).ToList();
- return getDataLists;
- }
- }
- #endregion
-
- #region 选择单位工程、探伤类型、探伤比例、点口批号获取需要进行点口的批
- ///
- /// 选择单位工程、探伤类型、探伤比例、点口批号获取还未点口的批
- ///
- ///
- ///
- ///
- ///
- ///
- public static List getAutoPointBatchCode(string unitWorkId, string detectionTypeId, string detectionRateId, string pointBatchCode)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var dataList = from x in db.HJGL_Batch_PointBatch
- where x.UnitWorkId == unitWorkId && x.EndDate == null
- select x;
-
- if (!string.IsNullOrEmpty(detectionTypeId))
- {
- dataList = dataList.Where(e => e.DetectionTypeId == detectionTypeId);
- }
- if (!string.IsNullOrEmpty(detectionRateId))
- {
- dataList = dataList.Where(e => e.DetectionRateId == detectionRateId);
- }
- if (!string.IsNullOrEmpty(pointBatchCode))
- {
- dataList = dataList.Where(e => e.PointBatchCode.Contains(pointBatchCode));
- }
-
- var getDataLists = (from x in dataList
- orderby x.PointBatchCode
- select new Model.NDETrustItem
- {
- PointBatchId = x.PointBatchId,
- PointBatchCode = x.PointBatchCode,
- }).ToList();
- return getDataLists;
- }
- }
- #endregion
-
- #region 根据单位工程、点口批号、批开始时间获取需要调整的批(已点口但还未进行委托的批列表)
- ///
- /// 根据单位工程、点口批号、批开始时间获取需要调整的批(已点口但还未进行委托的批列表)
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public static List getPointBatchCode(string unitWorkId, string startDate, string detectionTypeId, string detectionRateId, string pointBatchCode)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var dataList = from x in db.HJGL_Batch_PointBatch
- join y in db.HJGL_Batch_PointBatchItem on x.PointBatchId equals y.PointBatchId
- where x.UnitWorkId == unitWorkId
- //&& y.IsBuildTrust == null
- //&& x.EndDate.HasValue
- select x;
-
-
- if (!string.IsNullOrEmpty(startDate))
- {
- DateTime t = Convert.ToDateTime(startDate + "-01");
- DateTime mt = t.AddMonths(1);
- dataList = dataList.Where(e => e.StartDate >= t && e.StartDate < mt);
- }
-
- if (!string.IsNullOrEmpty(detectionTypeId))
- {
- dataList = dataList.Where(e => e.DetectionTypeId == detectionTypeId);
- }
- if (!string.IsNullOrEmpty(detectionRateId))
- {
- dataList = dataList.Where(e => e.DetectionRateId == detectionRateId);
- }
- if (!string.IsNullOrEmpty(pointBatchCode))
- {
- dataList = dataList.Where(e => e.PointBatchCode.Contains(pointBatchCode));
- }
- List list = new List();
- foreach (var item in dataList)
- {
- var trustItem = (from x in Funs.DB.HJGL_Batch_BatchTrustItem
- join y in Funs.DB.HJGL_Batch_PointBatchItem on x.PointBatchItemId equals y.PointBatchItemId
- where y.PointBatchId == item.PointBatchId
- select x).FirstOrDefault();
- if (trustItem == null && item.IsClosed != true)
- {
- list.Add(item);
- }
- }
- list = list.Distinct().ToList();
- var getDataLists = (from x in list
- orderby x.PointBatchCode
- select new Model.NDETrustItem
- {
- PointBatchId = x.PointBatchId,
- PointBatchCode = x.PointBatchCode,
- }).Distinct().ToList();
- return getDataLists;
- }
- }
- #endregion
-
- #region 根据点口批ID获取批明细(自动点口呈现)
- ///
- /// 根据点口批ID获取批明细(自动点口呈现)
- ///
- ///
- ///
- ///
- public static List getPointBatchDetail(string pointBatchId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var getDataLists = (from x in db.HJGL_Batch_PointBatchItem
- join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
- where x.PointBatchId == pointBatchId
- select new Model.NDETrustItem
- {
- WeldJointId = x.WeldJointId,
- PointState = x.PointState,
- WeldJointCode = y.WeldJointCode,
- PipelineCode = y.PipelineCode,
- JointArea = y.JointArea,
- AttachUrl = y.AttachUrl,
- PointBatchItemId = x.PointBatchItemId,
- }).ToList();
-
- return getDataLists;
- }
- }
- #endregion
-
- #region 根据点口批ID获取已点口还未审批的焊口
- ///
- /// 根据点口批ID获取已点口还未审批的焊口
- ///
- ///
- ///
- ///
- public static List getPointWeldJoint(string pointBatchId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var getDataLists = (from x in db.HJGL_Batch_PointBatchItem
- join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
- where x.IsBuildTrust == null && x.PointBatchId == pointBatchId && x.PointState == "1"
- orderby y.WeldJointCode
- select new Model.NDETrustItem
- {
- WeldJointId = x.WeldJointId,
- WeldJointCode = y.WeldJointCode,
- PipelineCode = y.PipelineCode,
- JointArea = y.JointArea,
- AttachUrl = y.AttachUrl
- }).ToList();
-
- return getDataLists;
- }
- }
- #endregion
-
- #region 根据点口批ID和焊口ID获取待调整焊口
- ///
- /// 根据点口批ID和焊口ID获取待调整焊口
- ///
- ///
- ///
- ///
- public static List getPointWeldJoint(string pointBatchId, string weldJointId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var jot = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
-
- var getDataLists = (from x in Funs.DB.HJGL_Batch_PointBatchItem
- join y in Funs.DB.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
- where x.PointBatchId == pointBatchId
- //&& x.PointState == null
- //&& y.JointAttribute == jot.JointAttribute
- orderby y.WeldJointCode
- select new Model.NDETrustItem
- {
- WeldJointId = x.WeldJointId,
- WeldJointCode = y.WeldJointCode,
- PipelineCode = y.PipelineCode,
- PointBatchItemId = x.PointBatchItemId,
- JointArea = y.JointArea,
- AttachUrl = y.AttachUrl
- }).ToList();
-
- return getDataLists;
- }
- }
- #endregion
-
- #region 对所选批次进行自动点口
- ///
- /// 对所选批次进行自动点口
- ///
- ///
- public static void AutoPointSave(string pointBatchId)
- {
- BLL.PointBatchDetailService.AutoPoint(pointBatchId);
- }
- #endregion
- ///
- /// 手动点口
- ///
- ///
- ///
- public static string ManualPointSave(string weldJointId)
- {
- string res = "";
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var PointBatchItemModel = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.WeldJointId == weldJointId);
- var PointBatchId = PointBatchItemModel.PointBatchId;
- var batch = BLL.PointBatchService.GetPointBatchById(PointBatchId);
- if (!batch.EndDate.HasValue)
- {
- var weldJoint = (from x in db.View_HJGL_WeldJoint
- where x.WeldJointId == weldJointId
- select x).FirstOrDefault();
- Model.Project_Sys_Set batchSet = BLL.Project_SysSetService.GetSysSetBySetId("5", weldJoint.ProjectId);
- if (batchSet != null && weldJoint != null)
- {
- int needJointNum = 0;
- int pointNumG = 0;
- int pointNumA = 0;
- if (batchSet.SetValue.Contains("6")) //按管线组批
- {
- var pipeline = (from x in db.HJGL_Pipeline
- join y in db.HJGL_WeldJoint on x.PipelineId equals y.PipelineId
- join z in db.HJGL_Batch_PointBatchItem on y.WeldJointId equals z.WeldJointId
- where z.PointBatchId == PointBatchId
- select x).FirstOrDefault();
- if (pipeline != null)
- {
- Model.Base_DetectionRate rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(pipeline.DetectionRateId);
- if (rate != null)
- {
- int totalJointCount = db.HJGL_WeldJoint.Count(x => x.PipelineId == pipeline.PipelineId);
- needJointNum = Convert.ToInt32(Math.Ceiling((totalJointCount * rate.DetectionRateValue.Value) * 0.01));
- // 安装口检测数量
- pointNumG = Convert.ToInt32(Math.Ceiling(needJointNum * 0.4));
- // 预制口要检测的数量
- pointNumA = needJointNum - pointNumG;
- var pointGNum = (from x in db.HJGL_Batch_PointBatchItem
- join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
- where y.PipelineId == pipeline.PipelineId && x.PointState == "1" && y.JointAttribute == "安装口"
- select x).Count();
- var pointNotGNum = (from x in db.HJGL_Batch_PointBatchItem
- join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
- where y.PipelineId == pipeline.PipelineId && x.PointState == "1" && y.JointAttribute == "预制口"
- select x).Count();
- if (weldJoint.JointAttribute == "安装口" && pointGNum >= pointNumG)
- {
- res = "安装口已达检测标准,无需再点此安装口!";
- return res;
- }
- if (weldJoint.JointAttribute == "预制口" && pointNotGNum >= pointNumA)
- {
- res = "预制口已达检测标准,无需再点此预制口!";
- return res;
- }
- }
- }
-
- }
- else //不按管线组批
- {
- string unitWorkId = weldJoint.UnitWorkId;
- string rateId = weldJoint.DetectionRateId;
- string detectionType = weldJoint.DetectionType;
- int totalJointNum = (from x in db.HJGL_WeldJoint
- join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
- where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionType == detectionType
- select x).Count();
- Model.Base_DetectionRate rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(rateId);
- if (rate != null)
- {
- needJointNum = Convert.ToInt32(Math.Ceiling((totalJointNum * rate.DetectionRateValue.Value) * 0.01));
- // 安装口检测数量
- pointNumG = Convert.ToInt32(Math.Ceiling(needJointNum * 0.4));
- // 预制口要检测的数量
- pointNumA = needJointNum - pointNumG;
- var pointGNum = (from x in db.HJGL_Batch_PointBatchItem
- join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId
- join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
- where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionTypeId == detectionType
- && x.PointState == "1" && z.JointAttribute == "安装口"
- select x).Count();
- var pointNotGNum = (from x in db.HJGL_Batch_PointBatchItem
- join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId
- join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
- where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionTypeId == detectionType
- && x.PointState == "1" && z.JointAttribute == "预制口"
- select x).Count();
- if (weldJoint.JointAttribute == "安装口" && pointGNum >= pointNumG)
- {
+ /// 项目Id
+ ///
+ public static List getNotEndPointBatch(string unitWorkId, string projectId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ //var notTrustDataList = from x in db.HJGL_Batch_PointBatch
+ // where x.UnitWorkId == unitWorkId && x.EndDate != null && x.ProjectId == projectId
+ // && (from y in db.HJGL_Batch_BatchTrustItem
+ // join z in db.HJGL_Batch_PointBatchItem on y.PointBatchItemId equals z.PointBatchItemId
+ // where z.PointBatchId == x.PointBatchId
+ // select y).Count() == 0
+ // select x;
+ //var dataList = from x in db.HJGL_Batch_PointBatch
+ // where x.UnitWorkId == unitWorkId && x.EndDate == null && x.ProjectId == projectId
+ // select x;
+ var dataList = from x in db.HJGL_Batch_PointBatch
+ where x.UnitWorkId == unitWorkId && x.ProjectId == projectId
+ && (x.EndDate == null || (from y in db.HJGL_Batch_BatchTrustItem
+ join z in db.HJGL_Batch_PointBatchItem on y.PointBatchItemId equals z.PointBatchItemId
+ where z.PointBatchId == x.PointBatchId
+ select y).Count() == 0)
+ select x;
+ var getDataLists = (from x in dataList
+ orderby x.PointBatchCode
+ select new Model.NDETrustItem
+ {
+ PointBatchId = x.PointBatchId,
+ PointBatchCode = x.PointBatchCode,
+ }).ToList();
+ return getDataLists;
+ }
+ }
+ #endregion
+
+ #region 选择单位工程、探伤类型、探伤比例、点口批号获取需要进行点口的批
+ ///
+ /// 选择单位工程、探伤类型、探伤比例、点口批号获取还未点口的批
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static List getAutoPointBatchCode(string unitWorkId, string detectionTypeId, string detectionRateId, string pointBatchCode)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var dataList = from x in db.HJGL_Batch_PointBatch
+ where x.UnitWorkId == unitWorkId && x.EndDate == null
+ select x;
+
+ if (!string.IsNullOrEmpty(detectionTypeId))
+ {
+ dataList = dataList.Where(e => e.DetectionTypeId == detectionTypeId);
+ }
+ if (!string.IsNullOrEmpty(detectionRateId))
+ {
+ dataList = dataList.Where(e => e.DetectionRateId == detectionRateId);
+ }
+ if (!string.IsNullOrEmpty(pointBatchCode))
+ {
+ dataList = dataList.Where(e => e.PointBatchCode.Contains(pointBatchCode));
+ }
+
+ var getDataLists = (from x in dataList
+ orderby x.PointBatchCode
+ select new Model.NDETrustItem
+ {
+ PointBatchId = x.PointBatchId,
+ PointBatchCode = x.PointBatchCode,
+ }).ToList();
+ return getDataLists;
+ }
+ }
+ #endregion
+
+ #region 根据单位工程、点口批号、批开始时间获取需要调整的批(已点口但还未进行委托的批列表)
+ ///
+ /// 根据单位工程、点口批号、批开始时间获取需要调整的批(已点口但还未进行委托的批列表)
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static List getPointBatchCode(string unitWorkId, string startDate, string detectionTypeId, string detectionRateId, string pointBatchCode)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var dataList = from x in db.HJGL_Batch_PointBatch
+ join y in db.HJGL_Batch_PointBatchItem on x.PointBatchId equals y.PointBatchId
+ where x.UnitWorkId == unitWorkId
+ //&& y.IsBuildTrust == null
+ //&& x.EndDate.HasValue
+ select x;
+
+
+ if (!string.IsNullOrEmpty(startDate))
+ {
+ DateTime t = Convert.ToDateTime(startDate + "-01");
+ DateTime mt = t.AddMonths(1);
+ dataList = dataList.Where(e => e.StartDate >= t && e.StartDate < mt);
+ }
+
+ if (!string.IsNullOrEmpty(detectionTypeId))
+ {
+ dataList = dataList.Where(e => e.DetectionTypeId == detectionTypeId);
+ }
+ if (!string.IsNullOrEmpty(detectionRateId))
+ {
+ dataList = dataList.Where(e => e.DetectionRateId == detectionRateId);
+ }
+ if (!string.IsNullOrEmpty(pointBatchCode))
+ {
+ dataList = dataList.Where(e => e.PointBatchCode.Contains(pointBatchCode));
+ }
+ List list = new List();
+ foreach (var item in dataList)
+ {
+ var trustItem = (from x in Funs.DB.HJGL_Batch_BatchTrustItem
+ join y in Funs.DB.HJGL_Batch_PointBatchItem on x.PointBatchItemId equals y.PointBatchItemId
+ where y.PointBatchId == item.PointBatchId
+ select x).FirstOrDefault();
+ if (trustItem == null && item.IsClosed != true)
+ {
+ list.Add(item);
+ }
+ }
+ list = list.Distinct().ToList();
+ var getDataLists = (from x in list
+ orderby x.PointBatchCode
+ select new Model.NDETrustItem
+ {
+ PointBatchId = x.PointBatchId,
+ PointBatchCode = x.PointBatchCode,
+ }).Distinct().ToList();
+ return getDataLists;
+ }
+ }
+ #endregion
+
+ #region 根据点口批ID获取批明细(自动点口呈现)
+ ///
+ /// 根据点口批ID获取批明细(自动点口呈现)
+ ///
+ ///
+ ///
+ ///
+ public static List getPointBatchDetail(string pointBatchId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getDataLists = (from x in db.HJGL_Batch_PointBatchItem
+ join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
+ where x.PointBatchId == pointBatchId
+ select new Model.NDETrustItem
+ {
+ WeldJointId = x.WeldJointId,
+ PointState = x.PointState,
+ WeldJointCode = y.WeldJointCode,
+ PipelineCode = y.PipelineCode,
+ JointArea = y.JointArea,
+ AttachUrl = y.AttachUrl,
+ PointBatchItemId = x.PointBatchItemId,
+ }).ToList();
+
+ return getDataLists;
+ }
+ }
+ #endregion
+
+ #region 根据点口批ID获取已点口还未审批的焊口
+ ///
+ /// 根据点口批ID获取已点口还未审批的焊口
+ ///
+ ///
+ ///
+ ///
+ public static List getPointWeldJoint(string pointBatchId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getDataLists = (from x in db.HJGL_Batch_PointBatchItem
+ join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
+ where x.IsBuildTrust == null && x.PointBatchId == pointBatchId && x.PointState == "1"
+ orderby y.WeldJointCode
+ select new Model.NDETrustItem
+ {
+ WeldJointId = x.WeldJointId,
+ WeldJointCode = y.WeldJointCode,
+ PipelineCode = y.PipelineCode,
+ JointArea = y.JointArea,
+ AttachUrl = y.AttachUrl
+ }).ToList();
+
+ return getDataLists;
+ }
+ }
+ #endregion
+
+ #region 根据点口批ID和焊口ID获取待调整焊口
+ ///
+ /// 根据点口批ID和焊口ID获取待调整焊口
+ ///
+ ///
+ ///
+ ///
+ public static List getPointWeldJoint(string pointBatchId, string weldJointId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var jot = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
+
+ var getDataLists = (from x in Funs.DB.HJGL_Batch_PointBatchItem
+ join y in Funs.DB.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
+ where x.PointBatchId == pointBatchId
+ //&& x.PointState == null
+ //&& y.JointAttribute == jot.JointAttribute
+ orderby y.WeldJointCode
+ select new Model.NDETrustItem
+ {
+ WeldJointId = x.WeldJointId,
+ WeldJointCode = y.WeldJointCode,
+ PipelineCode = y.PipelineCode,
+ PointBatchItemId = x.PointBatchItemId,
+ JointArea = y.JointArea,
+ AttachUrl = y.AttachUrl
+ }).ToList();
+
+ return getDataLists;
+ }
+ }
+ #endregion
+
+ #region 对所选批次进行自动点口
+ ///
+ /// 对所选批次进行自动点口
+ ///
+ ///
+ public static void AutoPointSave(string pointBatchId)
+ {
+ BLL.PointBatchDetailService.AutoPoint(pointBatchId);
+ }
+ #endregion
+ ///
+ /// 手动点口
+ ///
+ ///
+ ///
+ public static string ManualPointSave(string weldJointId)
+ {
+ string res = "";
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var PointBatchItemModel = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.WeldJointId == weldJointId);
+ var PointBatchId = PointBatchItemModel.PointBatchId;
+ var batch = BLL.PointBatchService.GetPointBatchById(PointBatchId);
+ if (!batch.EndDate.HasValue)
+ {
+ var weldJoint = (from x in db.View_HJGL_WeldJoint
+ where x.WeldJointId == weldJointId
+ select x).FirstOrDefault();
+ Model.Project_Sys_Set batchSet = BLL.Project_SysSetService.GetSysSetBySetId("5", weldJoint.ProjectId);
+ if (batchSet != null && weldJoint != null)
+ {
+ int needJointNum = 0;
+ int pointNumG = 0;
+ int pointNumA = 0;
+ if (batchSet.SetValue.Contains("6")) //按管线组批
+ {
+ var pipeline = (from x in db.HJGL_Pipeline
+ join y in db.HJGL_WeldJoint on x.PipelineId equals y.PipelineId
+ join z in db.HJGL_Batch_PointBatchItem on y.WeldJointId equals z.WeldJointId
+ where z.PointBatchId == PointBatchId
+ select x).FirstOrDefault();
+ if (pipeline != null)
+ {
+ Model.Base_DetectionRate rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(pipeline.DetectionRateId);
+ if (rate != null)
+ {
+ int totalJointCount = db.HJGL_WeldJoint.Count(x => x.PipelineId == pipeline.PipelineId);
+ needJointNum = Convert.ToInt32(Math.Ceiling((totalJointCount * rate.DetectionRateValue.Value) * 0.01));
+ // 安装口检测数量
+ pointNumG = Convert.ToInt32(Math.Ceiling(needJointNum * 0.4));
+ // 预制口要检测的数量
+ pointNumA = needJointNum - pointNumG;
+ var pointGNum = (from x in db.HJGL_Batch_PointBatchItem
+ join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
+ where y.PipelineId == pipeline.PipelineId && x.PointState == "1" && y.JointAttribute == "安装口"
+ select x).Count();
+ var pointNotGNum = (from x in db.HJGL_Batch_PointBatchItem
+ join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
+ where y.PipelineId == pipeline.PipelineId && x.PointState == "1" && y.JointAttribute == "预制口"
+ select x).Count();
+ if (weldJoint.JointAttribute == "安装口" && pointGNum >= pointNumG)
+ {
+ res = "安装口已达检测标准,无需再点此安装口!";
+ return res;
+ }
+ if (weldJoint.JointAttribute == "预制口" && pointNotGNum >= pointNumA)
+ {
+ res = "预制口已达检测标准,无需再点此预制口!";
+ return res;
+ }
+ }
+ }
+
+ }
+ else //不按管线组批
+ {
+ string unitWorkId = weldJoint.UnitWorkId;
+ string rateId = weldJoint.DetectionRateId;
+ string detectionType = weldJoint.DetectionType;
+ int totalJointNum = (from x in db.HJGL_WeldJoint
+ join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
+ where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionType == detectionType
+ select x).Count();
+ Model.Base_DetectionRate rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(rateId);
+ if (rate != null)
+ {
+ needJointNum = Convert.ToInt32(Math.Ceiling((totalJointNum * rate.DetectionRateValue.Value) * 0.01));
+ // 安装口检测数量
+ pointNumG = Convert.ToInt32(Math.Ceiling(needJointNum * 0.4));
+ // 预制口要检测的数量
+ pointNumA = needJointNum - pointNumG;
+ var pointGNum = (from x in db.HJGL_Batch_PointBatchItem
+ join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId
+ join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
+ where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionTypeId == detectionType
+ && x.PointState == "1" && z.JointAttribute == "安装口"
+ select x).Count();
+ var pointNotGNum = (from x in db.HJGL_Batch_PointBatchItem
+ join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId
+ join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
+ where y.DetectionRateId == rateId && y.UnitWorkId == unitWorkId && y.DetectionTypeId == detectionType
+ && x.PointState == "1" && z.JointAttribute == "预制口"
+ select x).Count();
+ if (weldJoint.JointAttribute == "安装口" && pointGNum >= pointNumG)
+ {
res = "安装口已达检测标准,无需再点此安装口!";
- return res;
- }
- if (weldJoint.JointAttribute == "预制口" && pointNotGNum >= pointNumA)
- {
+ return res;
+ }
+ if (weldJoint.JointAttribute == "预制口" && pointNotGNum >= pointNumA)
+ {
res = "预制口已达检测标准,无需再点此预制口!";
- return res;
- }
- }
- }
- }
- PointBatchDetailService.UpdatePointBatchDetail(PointBatchItemModel.PointBatchItemId, "1", System.DateTime.Now);
-
-
- }
- else
- {
- res = "批已关闭,不能点口!";
- }
- }
- return res;
-
- }
- #region 点口调整
- ///
- /// 点口调整
- ///
- /// 原来点的焊口
- /// 调为新的焊口
- public static void RePointSave(string oldJointId, string newJointId)
- {
- var oldPoint = BLL.PointBatchDetailService.GetBatchDetailByJotId(oldJointId);
- if (oldPoint != null)
- {
- oldPoint.PointDate = null;
- oldPoint.PointState = null;
- oldPoint.IsAudit = null;
- oldPoint.IsPipelineFirst = null;
- oldPoint.IsWelderFirst = null;
- }
-
- var newPoint = BLL.PointBatchDetailService.GetBatchDetailByJotId(newJointId);
- if (newPoint != null)
- {
- newPoint.PointState = "1";
- newPoint.PointDate = DateTime.Now;
- }
-
- Funs.DB.SubmitChanges();
- }
- #endregion
-
+ return res;
+ }
+ }
+ }
+ }
+ PointBatchDetailService.UpdatePointBatchDetail(PointBatchItemModel.PointBatchItemId, "1", System.DateTime.Now);
+
+
+ }
+ else
+ {
+ res = "批已关闭,不能点口!";
+ }
+ }
+ return res;
+
+ }
+ #region 点口调整
+ ///
+ /// 点口调整
+ ///
+ /// 原来点的焊口
+ /// 调为新的焊口
+ public static void RePointSave(string oldJointId, string newJointId)
+ {
+ var oldPoint = BLL.PointBatchDetailService.GetBatchDetailByJotId(oldJointId);
+ if (oldPoint != null)
+ {
+ oldPoint.PointDate = null;
+ oldPoint.PointState = null;
+ oldPoint.IsAudit = null;
+ oldPoint.IsPipelineFirst = null;
+ oldPoint.IsWelderFirst = null;
+ }
+
+ var newPoint = BLL.PointBatchDetailService.GetBatchDetailByJotId(newJointId);
+ if (newPoint != null)
+ {
+ newPoint.PointState = "1";
+ newPoint.PointDate = DateTime.Now;
+ }
+
+ Funs.DB.SubmitChanges();
+ }
+ #endregion
+
#region 生成委托
///
/// 生成委托
@@ -411,899 +411,899 @@ namespace BLL
/// 委托
///
public static string SaveTrust(string pointBatchId, string nDEUnit)
- {
- string result = string.Empty;
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- Model.HJGL_Batch_PointBatch batch = BLL.PointBatchService.GetPointBatchById(pointBatchId);
- if (batch != null)
- {
- Model.HJGL_Batch_BatchTrust newBatchTrust = new Model.HJGL_Batch_BatchTrust();
- var project = BLL.ProjectService.GetProjectByProjectId(batch.ProjectId);
- var unit = BLL.UnitService.GetUnitByUnitId(batch.UnitId);
- var area = BLL.UnitWorkService.getUnitWorkByUnitWorkId(batch.UnitWorkId);
- var ndt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(batch.DetectionTypeId);
- var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(batch.DetectionRateId);
-
- string perfix = string.Empty;
-
- newBatchTrust.TrustBatchCode = batch.PointBatchCode.Replace("-DK-", "-WT-");
- string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust));
- newBatchTrust.TrustBatchId = trustBatchId;
-
- newBatchTrust.TrustDate = DateTime.Now;
- newBatchTrust.ProjectId = batch.ProjectId;
- newBatchTrust.PointBatchId = batch.PointBatchId;
- newBatchTrust.UnitId = batch.UnitId;
- newBatchTrust.UnitWorkId = batch.UnitWorkId;
- newBatchTrust.DetectionTypeId = batch.DetectionTypeId;
- newBatchTrust.DetectionRateId = batch.DetectionRateId;
- newBatchTrust.NDEUnit = nDEUnit;
- newBatchTrust.PointBatchId = pointBatchId;
- BLL.Batch_BatchTrustService.AddBatchTrust(newBatchTrust); // 新增委托单
-
- // 生成委托条件对比
- var generateTrustItem = from x in db.View_GenerateTrustItem
- where x.PointBatchId == pointBatchId
- select x;
-
- List toPointBatchList = generateTrustItem.Select(x => x.PointBatchId).Distinct().ToList();
-
- // 生成委托明细,并回写点口明细信息
- foreach (var item in generateTrustItem)
- {
- if (BLL.Batch_BatchTrustItemService.GetIsGenerateTrust(item.PointBatchItemId)) ////生成委托单的条件判断
- {
- Model.HJGL_Batch_BatchTrustItem trustItem = new Model.HJGL_Batch_BatchTrustItem
- {
- TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem)),
- TrustBatchId = trustBatchId,
- PointBatchItemId = item.PointBatchItemId,
- WeldJointId = item.WeldJointId,
- CreateDate = DateTime.Now
- };
- Batch_BatchTrustItemService.AddBatchTrustItem(trustItem);
- }
-
- Model.HJGL_Batch_PointBatchItem pointBatchItem = db.HJGL_Batch_PointBatchItem.First(x => x.PointBatchItemId == item.PointBatchItemId);
-
- pointBatchItem.IsBuildTrust = true;
- db.SubmitChanges();
- }
-
-
- // 回写委托批对应点口信息
- if (toPointBatchList.Count() > 0)
- {
- string toPointBatch = String.Join(",", toPointBatchList);
-
- var updateTrut = BLL.Batch_BatchTrustService.GetBatchTrustById(trustBatchId);
- if (updateTrut != null)
- {
- updateTrut.TopointBatch = toPointBatch;
- BLL.Batch_BatchTrustService.UpdateBatchTrust(updateTrut);
- }
- }
- result = "委托成功!";
- }
- }
- return result;
- }
- #endregion
-
- #region 根据单位工程获取所有已点的焊口列表
- ///
- /// 根据单位工程获取所有已点的焊口列表
- ///
- ///
- ///
- public static List GetPointWeldJointList(string unitWorkId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var getDataLists = (from x in db.HJGL_Batch_PointBatchItem
- join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
- join z in db.HJGL_Batch_PointBatch on x.PointBatchId equals z.PointBatchId
- where x.IsBuildTrust == null && z.UnitWorkId == unitWorkId
- && x.PointState == "1"
- select new Model.NDETrustItem
- {
- WeldJointId = x.WeldJointId,
- PointBatchCode = z.PointBatchCode,
- WeldJointCode = y.WeldJointCode,
- PipelineCode = y.PipelineCode,
- AttachUrl = y.AttachUrl
- }).ToList();
-
- return getDataLists;
- }
- }
- #endregion
-
- #region 根据单位工程获取所有已点的焊口生成委托单
- ///
- /// 根据单位工程获取所有已点的焊口生成委托单
- ///
- ///
- public static void GenerateTrust(string unitWorkId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var getViewGenerateTrustLists = (from x in db.View_GenerateTrust where x.UnitWorkId == unitWorkId select x).ToList();
-
- foreach (var trust in getViewGenerateTrustLists)
- {
- Model.HJGL_Batch_BatchTrust newBatchTrust = new Model.HJGL_Batch_BatchTrust();
- var project = BLL.ProjectService.GetProjectByProjectId(trust.ProjectId);
- var unit = BLL.UnitService.GetUnitByUnitId(trust.UnitId);
- var unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(trust.UnitWorkId);
- var ndt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(trust.DetectionTypeId);
- var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(trust.DetectionRateId);
-
- string perfix = string.Empty;
- perfix = unit.UnitCode + "-" + ndt.DetectionTypeCode + "-" + rate.DetectionRateValue.ToString() + "%-";
- newBatchTrust.TrustBatchCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.HJGL_Batch_BatchTrust", "TrustBatchCode", project.ProjectId, perfix);
-
- string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust));
- newBatchTrust.TrustBatchId = trustBatchId;
-
- newBatchTrust.TrustDate = DateTime.Now;
- newBatchTrust.ProjectId = trust.ProjectId;
- newBatchTrust.UnitId = trust.UnitId;
- newBatchTrust.UnitWorkId = trust.UnitWorkId;
- newBatchTrust.DetectionTypeId = trust.DetectionTypeId;
- newBatchTrust.NDEUnit = unitWork.NDEUnit;
-
- BLL.Batch_BatchTrustService.AddBatchTrust(newBatchTrust); // 新增委托单
-
- // 生成委托条件对比
- var generateTrustItem = from x in db.View_GenerateTrustItem
- where x.ProjectId == trust.ProjectId
- && x.UnitWorkId == trust.UnitWorkId && x.UnitId == trust.UnitId
- && x.DetectionTypeId == trust.DetectionTypeId
- && x.DetectionRateId == trust.DetectionRateId
- select x;
-
- List toPointBatchList = generateTrustItem.Select(x => x.PointBatchId).Distinct().ToList();
-
- // 生成委托明细,并回写点口明细信息
- foreach (var item in generateTrustItem)
- {
- if (BLL.Batch_BatchTrustItemService.GetIsGenerateTrust(item.PointBatchItemId)) ////生成委托单的条件判断
- {
- Model.HJGL_Batch_BatchTrustItem trustItem = new Model.HJGL_Batch_BatchTrustItem
- {
- TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem)),
- TrustBatchId = trustBatchId,
- PointBatchItemId = item.PointBatchItemId,
- WeldJointId = item.WeldJointId,
- CreateDate = DateTime.Now
- };
- Batch_BatchTrustItemService.AddBatchTrustItem(trustItem);
- }
-
- Model.HJGL_Batch_PointBatchItem pointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.PointBatchItemId == item.PointBatchItemId);
-
- pointBatchItem.IsBuildTrust = true;
- db.SubmitChanges();
- }
-
-
- // 回写委托批对应点口信息
- if (toPointBatchList.Count() > 0)
- {
- string toPointBatch = String.Join(",", toPointBatchList);
-
- var updateTrut = BLL.Batch_BatchTrustService.GetBatchTrustById(trustBatchId);
- if (updateTrut != null)
- {
- updateTrut.TopointBatch = toPointBatch;
- BLL.Batch_BatchTrustService.UpdateBatchTrust(updateTrut);
- }
- }
-
- }
- }
- }
- #endregion
-
- //////////////////////////////////////委托单/////////////////////////////////////////////////////////////
-
- #region 选择单位工程、探伤类型、探伤比例、委托单号等获取委托单
- ///
- /// 选择单位工程、探伤类型、探伤比例、委托单号等获取委托单
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public static List getBatchTrustCode(string unitWorkId, string detectionTypeId, string detectionRateId, string startDate, string trustBatchCode)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var dataList = from x in db.HJGL_Batch_PointBatch
- where x.UnitWorkId == unitWorkId && x.EndDate.HasValue && x.IsClosed == null
- select x;
-
- if (!string.IsNullOrEmpty(detectionTypeId))
- {
- dataList = dataList.Where(e => e.DetectionTypeId == detectionTypeId);
- }
- dataList = dataList.Where(e => e.DetectionRateId != "85a3e149-49a0-4ad1-85ab-27f8849c1c49"); //检测比例为0的批不显示
- if (!string.IsNullOrEmpty(detectionRateId))
- {
- dataList = dataList.Where(e => e.DetectionRateId == detectionRateId);
- }
-
- if (!string.IsNullOrEmpty(startDate))
- {
- DateTime t = Convert.ToDateTime(startDate + "-01");
- DateTime mt = t.AddMonths(1);
- dataList = dataList.Where(e => e.StartDate >= t && e.StartDate < mt);
- }
-
- if (!string.IsNullOrEmpty(trustBatchCode))
- {
- dataList = dataList.Where(e => e.PointBatchCode.Contains(trustBatchCode));
- }
- List list = new List();
- foreach (var item in dataList)
- {
+ {
+ string result = string.Empty;
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ Model.HJGL_Batch_PointBatch batch = BLL.PointBatchService.GetPointBatchById(pointBatchId);
+ if (batch != null)
+ {
+ string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust));
+
+ // 生成委托条件对比
+ var generateTrustItem = (from x in db.View_GenerateTrustItem
+ where x.PointBatchId == pointBatchId
+ select x).ToList();
+ if (generateTrustItem.Count == 0)
+ {
+ return "当前检验批没有可生成的委托明细!";
+ }
+
+ List toPointBatchList = generateTrustItem.Select(x => x.PointBatchId).Distinct().ToList();
+
+ Model.HJGL_Batch_BatchTrust newBatchTrust = new Model.HJGL_Batch_BatchTrust
+ {
+ TrustBatchId = trustBatchId,
+ TrustBatchCode = batch.PointBatchCode.Replace("-DK-", "-WT-"),
+ TrustDate = DateTime.Now,
+ ProjectId = batch.ProjectId,
+ PointBatchId = pointBatchId,
+ UnitId = batch.UnitId,
+ UnitWorkId = batch.UnitWorkId,
+ DetectionTypeId = batch.DetectionTypeId,
+ DetectionRateId = batch.DetectionRateId,
+ NDEUnit = nDEUnit,
+ IsAudit = true
+ };
+ db.HJGL_Batch_BatchTrust.InsertOnSubmit(newBatchTrust);
+
+ // 生成委托明细,并回写点口明细信息
+ foreach (var item in generateTrustItem)
+ {
+ if (BLL.Batch_BatchTrustItemService.GetIsGenerateTrust(item.PointBatchItemId)) ////生成委托单的条件判断
+ {
+ Model.HJGL_Batch_BatchTrustItem trustItem = new Model.HJGL_Batch_BatchTrustItem
+ {
+ TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem)),
+ TrustBatchId = trustBatchId,
+ PointBatchItemId = item.PointBatchItemId,
+ WeldJointId = item.WeldJointId,
+ CreateDate = DateTime.Now,
+ TrustNum = 1
+ };
+ db.HJGL_Batch_BatchTrustItem.InsertOnSubmit(trustItem);
+ }
+
+ Model.HJGL_Batch_PointBatchItem pointBatchItem = db.HJGL_Batch_PointBatchItem.First(x => x.PointBatchItemId == item.PointBatchItemId);
+
+ pointBatchItem.IsBuildTrust = true;
+ }
+
+
+ // 回写委托批对应点口信息
+ if (toPointBatchList.Count() > 0)
+ {
+ string toPointBatch = String.Join(",", toPointBatchList);
+ newBatchTrust.TopointBatch = toPointBatch;
+ }
+ db.SubmitChanges();
+ result = "委托成功!";
+ }
+ }
+ return result;
+ }
+ #endregion
+
+ #region 根据单位工程获取所有已点的焊口列表
+ ///
+ /// 根据单位工程获取所有已点的焊口列表
+ ///
+ ///
+ ///
+ public static List GetPointWeldJointList(string unitWorkId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getDataLists = (from x in db.HJGL_Batch_PointBatchItem
+ join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
+ join z in db.HJGL_Batch_PointBatch on x.PointBatchId equals z.PointBatchId
+ where x.IsBuildTrust == null && z.UnitWorkId == unitWorkId
+ && x.PointState == "1"
+ select new Model.NDETrustItem
+ {
+ WeldJointId = x.WeldJointId,
+ PointBatchCode = z.PointBatchCode,
+ WeldJointCode = y.WeldJointCode,
+ PipelineCode = y.PipelineCode,
+ AttachUrl = y.AttachUrl
+ }).ToList();
+
+ return getDataLists;
+ }
+ }
+ #endregion
+
+ #region 根据单位工程获取所有已点的焊口生成委托单
+ ///
+ /// 根据单位工程获取所有已点的焊口生成委托单
+ ///
+ ///
+ public static void GenerateTrust(string unitWorkId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getViewGenerateTrustLists = (from x in db.View_GenerateTrust where x.UnitWorkId == unitWorkId select x).ToList();
+
+ foreach (var trust in getViewGenerateTrustLists)
+ {
+ Model.HJGL_Batch_BatchTrust newBatchTrust = new Model.HJGL_Batch_BatchTrust();
+ var project = BLL.ProjectService.GetProjectByProjectId(trust.ProjectId);
+ var unit = BLL.UnitService.GetUnitByUnitId(trust.UnitId);
+ var unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(trust.UnitWorkId);
+ var ndt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(trust.DetectionTypeId);
+ var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(trust.DetectionRateId);
+
+ string perfix = string.Empty;
+ perfix = unit.UnitCode + "-" + ndt.DetectionTypeCode + "-" + rate.DetectionRateValue.ToString() + "%-";
+ string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust));
+
+ // 生成委托条件对比
+ var generateTrustItem = (from x in db.View_GenerateTrustItem
+ where x.ProjectId == trust.ProjectId
+ && x.UnitWorkId == trust.UnitWorkId && x.UnitId == trust.UnitId
+ && x.DetectionTypeId == trust.DetectionTypeId
+ && x.DetectionRateId == trust.DetectionRateId
+ select x).ToList();
+ if (generateTrustItem.Count == 0)
+ {
+ continue;
+ }
+
+ List toPointBatchList = generateTrustItem.Select(x => x.PointBatchId).Distinct().ToList();
+
+ newBatchTrust.TrustBatchCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.HJGL_Batch_BatchTrust", "TrustBatchCode", project.ProjectId, perfix);
+ newBatchTrust.TrustBatchId = trustBatchId;
+ newBatchTrust.TrustDate = DateTime.Now;
+ newBatchTrust.ProjectId = trust.ProjectId;
+ newBatchTrust.UnitId = trust.UnitId;
+ newBatchTrust.UnitWorkId = trust.UnitWorkId;
+ newBatchTrust.DetectionTypeId = trust.DetectionTypeId;
+ newBatchTrust.NDEUnit = unitWork.NDEUnit;
+ newBatchTrust.DetectionRateId = trust.DetectionRateId;
+ newBatchTrust.IsAudit = true;
+ db.HJGL_Batch_BatchTrust.InsertOnSubmit(newBatchTrust);
+
+ // 生成委托明细,并回写点口明细信息
+ foreach (var item in generateTrustItem)
+ {
+ if (BLL.Batch_BatchTrustItemService.GetIsGenerateTrust(item.PointBatchItemId)) ////生成委托单的条件判断
+ {
+ Model.HJGL_Batch_BatchTrustItem trustItem = new Model.HJGL_Batch_BatchTrustItem
+ {
+ TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem)),
+ TrustBatchId = trustBatchId,
+ PointBatchItemId = item.PointBatchItemId,
+ WeldJointId = item.WeldJointId,
+ CreateDate = DateTime.Now,
+ TrustNum = 1
+ };
+ db.HJGL_Batch_BatchTrustItem.InsertOnSubmit(trustItem);
+ }
+
+ Model.HJGL_Batch_PointBatchItem pointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.PointBatchItemId == item.PointBatchItemId);
+
+ if (pointBatchItem != null)
+ {
+ pointBatchItem.IsBuildTrust = true;
+ }
+ }
+
+
+ // 回写委托批对应点口信息
+ if (toPointBatchList.Count() > 0)
+ {
+ string toPointBatch = String.Join(",", toPointBatchList);
+ newBatchTrust.TopointBatch = toPointBatch;
+ }
+ db.SubmitChanges();
+
+ }
+ }
+ }
+ #endregion
+
+ //////////////////////////////////////委托单/////////////////////////////////////////////////////////////
+
+ #region 选择单位工程、探伤类型、探伤比例、委托单号等获取委托单
+ ///
+ /// 选择单位工程、探伤类型、探伤比例、委托单号等获取委托单
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static List getBatchTrustCode(string unitWorkId, string detectionTypeId, string detectionRateId, string startDate, string trustBatchCode)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var dataList = from x in db.HJGL_Batch_PointBatch
+ where x.UnitWorkId == unitWorkId && x.EndDate.HasValue && x.IsClosed == null
+ select x;
+
+ if (!string.IsNullOrEmpty(detectionTypeId))
+ {
+ dataList = dataList.Where(e => e.DetectionTypeId == detectionTypeId);
+ }
+ dataList = dataList.Where(e => e.DetectionRateId != "85a3e149-49a0-4ad1-85ab-27f8849c1c49"); //检测比例为0的批不显示
+ if (!string.IsNullOrEmpty(detectionRateId))
+ {
+ dataList = dataList.Where(e => e.DetectionRateId == detectionRateId);
+ }
+
+ if (!string.IsNullOrEmpty(startDate))
+ {
+ DateTime t = Convert.ToDateTime(startDate + "-01");
+ DateTime mt = t.AddMonths(1);
+ dataList = dataList.Where(e => e.StartDate >= t && e.StartDate < mt);
+ }
+
+ if (!string.IsNullOrEmpty(trustBatchCode))
+ {
+ dataList = dataList.Where(e => e.PointBatchCode.Contains(trustBatchCode));
+ }
+ List list = new List();
+ foreach (var item in dataList)
+ {
var trustItem = (from x in Funs.DB.HJGL_Batch_BatchTrustItem
join y in Funs.DB.HJGL_Batch_PointBatchItem on x.PointBatchItemId equals y.PointBatchItemId
where y.PointBatchId == item.PointBatchId
- select x).FirstOrDefault();
+ select x).FirstOrDefault();
if (trustItem == null)
- {
- list.Add(item);
- }
- }
- var getDataLists = (from x in list
- orderby x.PointBatchCode
- select new Model.BaseInfoItem
- {
- BaseInfoId = x.PointBatchId,
- BaseInfoCode = x.PointBatchCode
- //BaseInfoCode = (x.TrustType == "R" ? ("FXWT-" + x.TrustBatchCode.Substring(x.TrustBatchCode.Length - 4)) : ("WT-" + x.TrustBatchCode.Substring(x.TrustBatchCode.Length - 4))),
- }).ToList();
- return getDataLists;
- }
- }
- #endregion
-
- #region 选择委托单ID获取委托单明细信息
- ///
- /// 选择委托单ID获取委托单明细信息
- ///
- ///
- ///
- public static List GetBatchTrustDetail(string trustBatchId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var getDataLists = (from x in db.View_GenerateTrustItem
- where x.PointBatchId == trustBatchId
- orderby x.WeldJointCode
- select new Model.NDETrustItem
- {
- WeldJointCode = x.WeldJointCode,
- PipelineCode = x.PipelineCode,
- WelderCode = x.WelderCode,
- }).ToList();
-
- return getDataLists;
- }
- }
- #endregion
-
- #region 对所选委托单进行审核
- ///
- /// 对所选委托单进行审核
- ///
- ///
- public static void BatchTrustAudit(string trustBatchId)
- {
- BLL.Batch_BatchTrustService.UpdateBatchTrustAudit(trustBatchId, true);
- }
- #endregion
-
- ///////////////////////////////////////无损检测单////////////////////////////////////////////
- #region 无损检测单
- ///
- /// 选择单位工程、探伤类型、检测单号获取检测单
- ///
- ///
- ///
- ///
- ///
- public static List getBatchNdeCode(string unitWorkId, string startDate, string detectionTypeId, string ndeCode)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var dataList = from x in db.HJGL_Batch_NDE
- join y in db.HJGL_Batch_BatchTrust on x.TrustBatchId equals y.TrustBatchId
- where x.UnitWorkId == unitWorkId
- select new Model.BaseInfoItem
- {
- BaseInfoId = x.NDEID,
- NDEDate = y.TrustDate,
- BaseInfoCode = x.NDECode,
- BaseInfoName = y.DetectionTypeId
- };
- if (!string.IsNullOrEmpty(startDate))
- {
- DateTime t = Convert.ToDateTime(startDate + "-01");
- DateTime mt = t.AddMonths(1);
- dataList = dataList.Where(e => e.NDEDate >= t && e.NDEDate < mt);
- }
- if (!string.IsNullOrEmpty(detectionTypeId))
- {
- dataList = dataList.Where(e => e.BaseInfoName == detectionTypeId);
- }
-
- if (!string.IsNullOrEmpty(ndeCode))
- {
- dataList = dataList.Where(e => e.BaseInfoCode.Contains(ndeCode));
- }
-
- var getDataLists = (from x in dataList
- orderby x.BaseInfoCode
- select new Model.BaseInfoItem
- {
- BaseInfoId = x.BaseInfoId,
- BaseInfoCode = x.BaseInfoCode
- }).ToList();
- return getDataLists;
- }
- }
-
- ///
- /// 根据检测单ID获取检测单明细
- ///
- ///
- ///
- public static List GetBatchNDEDetail(string ndeId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var getDataLists = (from x in db.View_Batch_NDEItem
- where x.NDEID == ndeId
- orderby x.WeldJointCode
- select new Model.NDETrustItem
- {
- WeldJointCode = x.WeldJointCode,
- PipelineCode = x.PipelineCode,
- WelderCode = x.WelderCode,
- FilmDate = x.FilmDate,
- ReportDate = x.ReportDate,
- TotalFilm = x.TotalFilm,
- PassFilm = x.PassFilm,
- CheckResult = x.CheckResult == "1" ? "合格" : "不合格",
- JudgeGrade = x.JudgeGrade,
- CheckDefects = BLL.Base_DefectService.GetDefectNameStrByDefectIdStr(x.CheckDefects),
- RepairLocation = x.RepairLocation
- }).ToList();
-
- return getDataLists;
- }
- }
-
-
- #endregion
-
- //////////////////////////////////////返修/扩透/////////////////////////////////////
-
- #region 返修/扩透
- ///
- /// 获取返修单列表
- ///
- ///
- ///
- ///
- ///
- public static List GetRepairRecord(string unitWorkId, bool isAudit, string repairRecordCode)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var repair = (from x in db.HJGL_RepairRecord
- where x.UnitWorkId == unitWorkId
- orderby x.RepairRecordCode descending
- select x).ToList();
- if (isAudit)
- {
- repair = (from x in repair where x.AuditDate.HasValue select x).ToList();
- }
- else
- {
- repair = (from x in repair where !x.AuditDate.HasValue select x).ToList();
- }
-
- if (!string.IsNullOrEmpty(repairRecordCode))
- {
- repair = (from x in repair where x.RepairRecordCode.Contains(repairRecordCode) select x).ToList();
- }
-
- var getDataLists = (from x in repair
- select new Model.BaseInfoItem
- {
- BaseInfoId = x.RepairRecordId,
- BaseInfoCode = BLL.RepairRecordService.GetWeldJointCodeById(x.RepairRecordId),
- BaseInfoName = x.WeldJointId
- }).ToList();
- return getDataLists;
- }
- }
-
- ///
- /// 获取返修单信息
- ///
- ///
- ///
- public static Model.WeldJointItem GetRepairInfoByRepairRecordId(string repairRecordId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var getDataLists = (from x in db.HJGL_RepairRecord
- join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
- join z in db.SitePerson_Person on y.BackingWelderId equals z.PersonId
- where x.RepairRecordId == repairRecordId
- select new Model.WeldJointItem
- {
- PipelineCode = y.PipelineCode,
- WeldJointCode = y.WeldJointCode,
- BackingWelderCode = z.WelderCode,
- BackingWelderId = y.BackingWelderId
- }).FirstOrDefault();
- return getDataLists;
- }
- }
-
- ///
- /// 根据条件获取可选取扩透口的批明细
- ///
- ///
- /// 同焊工
- /// 同管线
- /// 同一天
- /// 返修前所焊
- /// 同材质
- /// 同规格
- ///
- public static List GetRepairExpDetail(string repairRecordId, bool welder, bool batch, bool pipeLine, bool daily, bool repairBefore, bool mat, bool spec)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var record = BLL.RepairRecordService.GetRepairRecordById(repairRecordId);
- var jot = BLL.WeldJointService.GetViewWeldJointById(record.WeldJointId);
- var day = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(jot.WeldingDailyId);
-
- var repairExp = from x in db.HJGL_Batch_PointBatchItem
- join z in db.HJGL_Batch_PointBatch on x.PointBatchId equals z.PointBatchId
- join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
- join d in db.HJGL_WeldingDaily on y.WeldingDailyId equals d.WeldingDailyId
- where z.DetectionTypeId == record.DetectionTypeId
- && !x.PointDate.HasValue || (x.PointDate.HasValue && x.RepairRecordId == repairRecordId)
- orderby y.WeldJointCode
- select new
- {
- x.PointBatchItemId,
- x.PointState,
- y.WeldJointCode,
- y.PipelineId,
- x.PointBatchId,
- y.PipelineCode,
- y.JointArea,
- y.BackingWelderId,
- y.Material1Id,
- y.Specification,
- d.WeldingDate
- };
-
- if (welder)
- {
- repairExp = repairExp.Where(x => x.BackingWelderId == jot.BackingWelderId);
- }
- if (batch)
- {
- repairExp = repairExp.Where(x => x.PointBatchId == jot.PointBatchId);
- }
- if (pipeLine)
- {
- repairExp = repairExp.Where(x => x.PipelineId == jot.PipelineId);
- }
- if (daily)
- {
- repairExp = repairExp.Where(x => x.WeldingDate == day.WeldingDate);
- }
- if (repairBefore)
- {
- repairExp = repairExp.Where(x => x.WeldingDate <= day.WeldingDate);
- }
- if (mat)
- {
- repairExp = repairExp.Where(x => x.Material1Id == jot.Material1Id);
- }
- if (spec)
- {
- repairExp = repairExp.Where(x => x.Specification == jot.Specification);
- }
-
- var getDataLists = (from x in repairExp
- select new Model.NDETrustItem
- {
- PointBatchItemId = x.PointBatchItemId,
- PointState = x.PointState,
- WeldJointCode = x.WeldJointCode,
- PipelineCode = x.PipelineCode,
- JointArea = x.JointArea
- }).ToList();
- return getDataLists;
- }
- }
-
- ///
- /// 保存返修/扩透口信息
- ///
- /// 返修ID
- /// 扩透口ID(多个用“,”号隔开)
- /// 返修焊工
- /// 返修日期
- /// 是否切除
- public static void GetRepairExpSaveInfo(string repairRecordId, string expandId, string repairWelder, string repairDate, bool isCut)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- Model.HJGL_RepairRecord repairRecord = BLL.RepairRecordService.GetRepairRecordById(repairRecordId);
- // 更新返修记录
- var repair = db.HJGL_RepairRecord.FirstOrDefault(x => x.RepairRecordId == repairRecordId);
- if (repair != null)
- {
- repair.PBackingWelderId = repairWelder;
- repair.PCoverWelderId = repairWelder;
- repair.AuditDate = DateTime.Now;
- repair.RepairDate = Convert.ToDateTime(repairDate);
- if (isCut)
- {
- repair.IsCut = true;
- }
- }
-
- // 更新返修口
- var batchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.WeldJointId == repairRecord.WeldJointId);
- if (batchItem != null)
- {
- batchItem.RepairDate = Convert.ToDateTime(repairDate);
- if (isCut)
- {
- batchItem.CutDate = DateTime.Now.Date;
- }
- }
- db.SubmitChanges();
-
- var exp = BLL.RepairRecordService.GetExportItem(repairRecordId);
- if (exp != null)
- {
- foreach (Model.HJGL_Batch_PointBatchItem item in exp)
- {
- Model.HJGL_Batch_PointBatchItem newPointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.PointBatchItemId == item.PointBatchItemId);
- newPointBatchItem.PointState = null;
- newPointBatchItem.PointDate = null;
- newPointBatchItem.RepairRecordId = null;
- db.SubmitChanges();
- }
- }
- // 更新扩透口
- string[] checkedRow = expandId.Split(',');
- if (checkedRow.Count() > 0)
- {
- foreach (string item in checkedRow)
- {
- Model.HJGL_Batch_PointBatchItem newPointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.PointBatchItemId == item);
- if (newPointBatchItem != null)
- {
- newPointBatchItem.PointState = "2";
- newPointBatchItem.PointDate = DateTime.Now;
- newPointBatchItem.RepairRecordId = repairRecordId;
- db.SubmitChanges();
- }
- }
- }
- }
- }
- #endregion
-
- #region 返修单审核
- ///
- /// 返修单审核
- ///
- ///
- public static void RepairAudit(string repairRecordId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- // 更新返修记录
- var repair = db.HJGL_RepairRecord.FirstOrDefault(x => x.RepairRecordId == repairRecordId);
- if (!repair.AuditDate.HasValue)
- {
- repair.AuditDate = DateTime.Now;
- db.SubmitChanges();
- }
- }
- }
- #endregion
-
- #region 生成返修委托单
- ///
- /// 生成返修委托单
- ///
- ///
- ///
- public static string GenerateRepairTrust(string repairRecordId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- string submitStr = string.Empty;
- Model.HJGL_RepairRecord repairRecord = BLL.RepairRecordService.GetRepairRecordById(repairRecordId);
- var trustItem = from x in Funs.DB.HJGL_Batch_BatchTrustItem where x.RepairRecordId == repairRecordId select x;
- if (trustItem.Count() == 0)
- {
- if (!string.IsNullOrEmpty(repairRecordId) && repairRecord.AuditDate.HasValue)
- {
- // 返修委托
- Model.HJGL_Batch_BatchTrust newRepairTrust = new Model.HJGL_Batch_BatchTrust();
- string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust));
- newRepairTrust.TrustBatchId = trustBatchId;
- newRepairTrust.TrustBatchCode = repairRecord.RepairRecordCode;
- newRepairTrust.TrustDate = DateTime.Now;
- newRepairTrust.ProjectId = repairRecord.ProjectId;
- newRepairTrust.UnitId = repairRecord.UnitId;
- newRepairTrust.UnitWorkId = repairRecord.UnitWorkId;
- newRepairTrust.DetectionTypeId = repairRecord.DetectionTypeId;
- var oldTrust = (from x in Funs.DB.HJGL_Batch_BatchTrust
join y in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchId equals y.TrustBatchId
join z in Funs.DB.HJGL_Batch_NDEItem on y.TrustBatchItemId equals z.TrustBatchItemId
where z.NDEItemID == repairRecord.NDEItemID
select x).FirstOrDefault();
newRepairTrust.DetectionRateId = oldTrust.DetectionRateId;
- newRepairTrust.TrustType = "R";
-
- BLL.Batch_BatchTrustService.AddBatchTrust(newRepairTrust); // 新增返修委托单
-
- Model.HJGL_Batch_BatchTrustItem newRepairTrustItem = new Model.HJGL_Batch_BatchTrustItem();
- newRepairTrustItem.TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem));
- newRepairTrustItem.TrustBatchId = trustBatchId;
- newRepairTrustItem.RepairRecordId = repairRecordId;
- newRepairTrustItem.WeldJointId = repairRecord.WeldJointId;
- newRepairTrustItem.CreateDate = DateTime.Now;
-
- Batch_BatchTrustItemService.AddBatchTrustItem(newRepairTrustItem);
-
- // 扩透委托
- var exp = BLL.RepairRecordService.GetExportItem(repairRecordId);
- if (exp != null)
- {
- foreach (var q in exp)
- {
- Model.HJGL_Batch_BatchTrustItem newExportTrustItem = new Model.HJGL_Batch_BatchTrustItem();
- newExportTrustItem.TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem));
- newExportTrustItem.TrustBatchId = trustBatchId;
- newExportTrustItem.PointBatchItemId = q.PointBatchItemId;
- newExportTrustItem.WeldJointId = q.WeldJointId;
- newExportTrustItem.CreateDate = DateTime.Now;
- Batch_BatchTrustItemService.AddBatchTrustItem(newExportTrustItem);
-
- Model.HJGL_Batch_PointBatchItem pointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.PointBatchItemId == q.PointBatchItemId);
- pointBatchItem.IsBuildTrust = true;
- db.SubmitChanges();
- }
- }
-
- submitStr = "成功生成委托单!";
- }
- else
- {
- submitStr = "选中返修单并确认已审核!";
- }
- }
- else
- {
- submitStr = "已生成委托单!";
- }
-
- return submitStr;
- }
- }
- #endregion
-
- #region 获取扩透口的随机数
- ///
- /// 获取扩透口的随机数
- ///
- ///
- ///
- public static string RandomExport(int num)
- {
- string strNum = string.Empty;
- if (num > 0 && num <= 2)
- {
- if (num == 1)
- {
- strNum = "0";
- }
- else
- {
- strNum = "0,1";
- }
- }
- else
- {
- int[] r = Funs.GetRandomNum(2, 0, num - 1);
- strNum = r[0].ToString() + "," + r[1].ToString();
- }
-
-
- //int num = Grid1.Rows.Count;
- //if (mark == "A")
- //{
- // if (pointState != "2") //非扩透口
- // {
- // if (num > 0 && num <= 2)
- // {
- // if (num == 1)
- // {
- // Grid1.SelectedRowIndexArray = new int[] { 0 };
- // }
- // else
- // {
- // Grid1.SelectedRowIndexArray = new int[] { 0, 1 };
- // }
- // }
- // else
- // {
- // int[] r = Funs.GetRandomNum(2, 0, num - 1);
- // Grid1.SelectedRowIndexArray = r;
- // }
- // }
- // else //扩透口
- // {
- // int[] groupNum = new int[num];
- // for (int i = 0; i < num; i++)
- // {
- // groupNum[i] = i;
- // }
-
- // Grid1.SelectedRowIndexArray = groupNum;
- // }
- //}
- //else
- //{
- // int[] groupNum = new int[num];
- // for (int i = 0; i < num; i++)
- // {
- // groupNum[i] = i;
- // }
-
- // Grid1.SelectedRowIndexArray = groupNum;
- //}
-
-
-
- return strNum;
-
- }
- #endregion
-
- //////////////////////////////////////////// NDE预警//////////////////////////////////////
-
- #region NDE预警
- ///
- /// 无损检测不合格焊口信息
- ///
- ///
- ///
- public static List GetNdeCheckNoPassWarn(string projectId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var onecheckNoPass = (from x in db.HJGL_Batch_NDEItem
- join y in db.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId
- join w in db.HJGL_WeldJoint on y.WeldJointId equals w.WeldJointId
- join z in db.HJGL_Batch_NDE on x.NDEID equals z.NDEID
- where y.RepairRecordId == null && x.CheckResult == "2"
- select new Model.BaseInfoItem
- {
- BaseInfoId = y.WeldJointId,
- BaseInfoCode = "检测单:" + z.NDECode,
- BaseInfoName = "不合格焊口:" + w.WeldJointCode
- }).ToList();
-
- var repairPass = (from x in db.HJGL_Batch_NDEItem
- join y in db.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId
- join w in db.HJGL_WeldJoint on y.WeldJointId equals w.WeldJointId
- join z in db.HJGL_Batch_NDE on x.NDEID equals z.NDEID
- where y.RepairRecordId != null && x.CheckResult == "1"
- select new Model.BaseInfoItem
- {
- BaseInfoId = y.WeldJointId,
- BaseInfoCode = "检测单:" + z.NDECode,
- BaseInfoName = "不合格焊口:" + w.WeldJointCode
- }).ToList();
-
- List getDataLists = new List();
- foreach (var q in onecheckNoPass)
- {
- if (!repairPass.Contains(q))
- {
- getDataLists.Add(q);
- }
- }
-
- return getDataLists;
- }
- }
-
- ///
- /// 未委托焊口预警
- ///
- ///
- ///
- public static List GetNoTrustJointWarn(string projectId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var point = (from x in db.HJGL_Batch_PointBatchItem
- join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId
- join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
- join t in db.HJGL_Batch_BatchTrustItem on x.PointBatchItemId equals t.PointBatchItemId
- where y.ProjectId == projectId && t.TrustBatchItemId == null
- orderby y.PointBatchCode, z.WeldJointCode
- select new Model.BaseInfoItem
- {
- BaseInfoId = x.WeldJointId,
- BaseInfoCode = "批号:" + y.PointBatchCode,
- BaseInfoName = "未委托焊口:" + z.WeldJointCode,
- }).ToList();
-
- var repair = (from x in db.HJGL_RepairRecord
- join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
- join t in db.HJGL_Batch_BatchTrustItem on x.RepairRecordId equals t.RepairRecordId
- where x.ProjectId == projectId && t.TrustBatchItemId == null
- orderby x.RepairRecordCode, z.WeldJointCode
- select new Model.BaseInfoItem
- {
- BaseInfoId = x.WeldJointId,
- BaseInfoCode = "返修单号:" + x.RepairRecordCode,
- BaseInfoName = "未委托焊口:" + z.WeldJointCode,
- }).ToList();
-
- return point.Concat(repair).ToList();
- }
- }
-
- ///
- /// 未检测焊口预警
- ///
- ///
- ///
- public static List GetNoCheckJointWarn(string projectId)
- {
- using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
- {
- var getDataLists = (from x in db.HJGL_Batch_BatchTrustItem
- join y in db.HJGL_Batch_BatchTrust on x.TrustBatchId equals y.TrustBatchId
- join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
- join n in db.HJGL_Batch_NDEItem on x.TrustBatchItemId equals n.TrustBatchItemId
- where y.ProjectId == projectId && n.NDEItemID == null
- orderby y.TrustBatchCode, z.WeldJointCode
- select new Model.BaseInfoItem
- {
- BaseInfoId = x.WeldJointId,
- BaseInfoCode = "委托单号:" + y.TrustBatchCode,
- BaseInfoName = "焊口:" + z.WeldJointCode,
- }).ToList();
-
- return getDataLists;
- }
- }
-
- #endregion
-
- }
-}
+ {
+ list.Add(item);
+ }
+ }
+ var getDataLists = (from x in list
+ orderby x.PointBatchCode
+ select new Model.BaseInfoItem
+ {
+ BaseInfoId = x.PointBatchId,
+ BaseInfoCode = x.PointBatchCode
+ //BaseInfoCode = (x.TrustType == "R" ? ("FXWT-" + x.TrustBatchCode.Substring(x.TrustBatchCode.Length - 4)) : ("WT-" + x.TrustBatchCode.Substring(x.TrustBatchCode.Length - 4))),
+ }).ToList();
+ return getDataLists;
+ }
+ }
+ #endregion
+
+ #region 选择委托单ID获取委托单明细信息
+ ///
+ /// 选择委托单ID获取委托单明细信息
+ ///
+ ///
+ ///
+ public static List GetBatchTrustDetail(string trustBatchId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getDataLists = (from x in db.View_Batch_BatchTrustItem
+ where x.TrustBatchId == trustBatchId
+ orderby x.WeldJointCode
+ select new Model.NDETrustItem
+ {
+ WeldJointCode = x.WeldJointCode,
+ PipelineCode = x.PipelineCode,
+ WelderCode = x.WelderCode,
+ }).ToList();
+
+ return getDataLists;
+ }
+ }
+ #endregion
+
+ #region 对所选委托单进行审核
+ ///
+ /// 对所选委托单进行审核
+ ///
+ ///
+ public static void BatchTrustAudit(string trustBatchId)
+ {
+ BLL.Batch_BatchTrustService.UpdateBatchTrustAudit(trustBatchId, true);
+ }
+ #endregion
+
+ ///////////////////////////////////////无损检测单////////////////////////////////////////////
+ #region 无损检测单
+ ///
+ /// 选择单位工程、探伤类型、检测单号获取检测单
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static List getBatchNdeCode(string unitWorkId, string startDate, string detectionTypeId, string ndeCode)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var dataList = from x in db.HJGL_Batch_NDE
+ join y in db.HJGL_Batch_BatchTrust on x.TrustBatchId equals y.TrustBatchId
+ where x.UnitWorkId == unitWorkId
+ select new Model.BaseInfoItem
+ {
+ BaseInfoId = x.NDEID,
+ NDEDate = y.TrustDate,
+ BaseInfoCode = x.NDECode,
+ BaseInfoName = y.DetectionTypeId
+ };
+ if (!string.IsNullOrEmpty(startDate))
+ {
+ DateTime t = Convert.ToDateTime(startDate + "-01");
+ DateTime mt = t.AddMonths(1);
+ dataList = dataList.Where(e => e.NDEDate >= t && e.NDEDate < mt);
+ }
+ if (!string.IsNullOrEmpty(detectionTypeId))
+ {
+ dataList = dataList.Where(e => e.BaseInfoName == detectionTypeId);
+ }
+
+ if (!string.IsNullOrEmpty(ndeCode))
+ {
+ dataList = dataList.Where(e => e.BaseInfoCode.Contains(ndeCode));
+ }
+
+ var getDataLists = (from x in dataList
+ orderby x.BaseInfoCode
+ select new Model.BaseInfoItem
+ {
+ BaseInfoId = x.BaseInfoId,
+ BaseInfoCode = x.BaseInfoCode
+ }).ToList();
+ return getDataLists;
+ }
+ }
+
+ ///
+ /// 根据检测单ID获取检测单明细
+ ///
+ ///
+ ///
+ public static List GetBatchNDEDetail(string ndeId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getDataLists = (from x in db.View_Batch_NDEItem
+ where x.NDEID == ndeId
+ orderby x.WeldJointCode
+ select new Model.NDETrustItem
+ {
+ WeldJointCode = x.WeldJointCode,
+ PipelineCode = x.PipelineCode,
+ WelderCode = x.WelderCode,
+ FilmDate = x.FilmDate,
+ ReportDate = x.ReportDate,
+ TotalFilm = x.TotalFilm,
+ PassFilm = x.PassFilm,
+ CheckResult = x.CheckResult == "1" ? "合格" : "不合格",
+ JudgeGrade = x.JudgeGrade,
+ CheckDefects = BLL.Base_DefectService.GetDefectNameStrByDefectIdStr(x.CheckDefects),
+ RepairLocation = x.RepairLocation
+ }).ToList();
+
+ return getDataLists;
+ }
+ }
+
+
+ #endregion
+
+ //////////////////////////////////////返修/扩透/////////////////////////////////////
+
+ #region 返修/扩透
+ ///
+ /// 获取返修单列表
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static List GetRepairRecord(string unitWorkId, bool isAudit, string repairRecordCode)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var repair = (from x in db.HJGL_RepairRecord
+ where x.UnitWorkId == unitWorkId
+ orderby x.RepairRecordCode descending
+ select x).ToList();
+ if (isAudit)
+ {
+ repair = (from x in repair where x.AuditDate.HasValue select x).ToList();
+ }
+ else
+ {
+ repair = (from x in repair where !x.AuditDate.HasValue select x).ToList();
+ }
+
+ if (!string.IsNullOrEmpty(repairRecordCode))
+ {
+ repair = (from x in repair where x.RepairRecordCode.Contains(repairRecordCode) select x).ToList();
+ }
+
+ var getDataLists = (from x in repair
+ select new Model.BaseInfoItem
+ {
+ BaseInfoId = x.RepairRecordId,
+ BaseInfoCode = BLL.RepairRecordService.GetWeldJointCodeById(x.RepairRecordId),
+ BaseInfoName = x.WeldJointId
+ }).ToList();
+ return getDataLists;
+ }
+ }
+
+ ///
+ /// 获取返修单信息
+ ///
+ ///
+ ///
+ public static Model.WeldJointItem GetRepairInfoByRepairRecordId(string repairRecordId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getDataLists = (from x in db.HJGL_RepairRecord
+ join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
+ join z in db.SitePerson_Person on y.BackingWelderId equals z.PersonId
+ where x.RepairRecordId == repairRecordId
+ select new Model.WeldJointItem
+ {
+ PipelineCode = y.PipelineCode,
+ WeldJointCode = y.WeldJointCode,
+ BackingWelderCode = z.WelderCode,
+ BackingWelderId = y.BackingWelderId
+ }).FirstOrDefault();
+ return getDataLists;
+ }
+ }
+
+ ///
+ /// 根据条件获取可选取扩透口的批明细
+ ///
+ ///
+ /// 同焊工
+ /// 同管线
+ /// 同一天
+ /// 返修前所焊
+ /// 同材质
+ /// 同规格
+ ///
+ public static List GetRepairExpDetail(string repairRecordId, bool welder, bool batch, bool pipeLine, bool daily, bool repairBefore, bool mat, bool spec)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var record = BLL.RepairRecordService.GetRepairRecordById(repairRecordId);
+ var jot = BLL.WeldJointService.GetViewWeldJointById(record.WeldJointId);
+ var day = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(jot.WeldingDailyId);
+
+ var repairExp = from x in db.HJGL_Batch_PointBatchItem
+ join z in db.HJGL_Batch_PointBatch on x.PointBatchId equals z.PointBatchId
+ join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
+ join d in db.HJGL_WeldingDaily on y.WeldingDailyId equals d.WeldingDailyId
+ where z.DetectionTypeId == record.DetectionTypeId
+ && !x.PointDate.HasValue || (x.PointDate.HasValue && x.RepairRecordId == repairRecordId)
+ orderby y.WeldJointCode
+ select new
+ {
+ x.PointBatchItemId,
+ x.PointState,
+ y.WeldJointCode,
+ y.PipelineId,
+ x.PointBatchId,
+ y.PipelineCode,
+ y.JointArea,
+ y.BackingWelderId,
+ y.Material1Id,
+ y.Specification,
+ d.WeldingDate
+ };
+
+ if (welder)
+ {
+ repairExp = repairExp.Where(x => x.BackingWelderId == jot.BackingWelderId);
+ }
+ if (batch)
+ {
+ repairExp = repairExp.Where(x => x.PointBatchId == jot.PointBatchId);
+ }
+ if (pipeLine)
+ {
+ repairExp = repairExp.Where(x => x.PipelineId == jot.PipelineId);
+ }
+ if (daily)
+ {
+ repairExp = repairExp.Where(x => x.WeldingDate == day.WeldingDate);
+ }
+ if (repairBefore)
+ {
+ repairExp = repairExp.Where(x => x.WeldingDate <= day.WeldingDate);
+ }
+ if (mat)
+ {
+ repairExp = repairExp.Where(x => x.Material1Id == jot.Material1Id);
+ }
+ if (spec)
+ {
+ repairExp = repairExp.Where(x => x.Specification == jot.Specification);
+ }
+
+ var getDataLists = (from x in repairExp
+ select new Model.NDETrustItem
+ {
+ PointBatchItemId = x.PointBatchItemId,
+ PointState = x.PointState,
+ WeldJointCode = x.WeldJointCode,
+ PipelineCode = x.PipelineCode,
+ JointArea = x.JointArea
+ }).ToList();
+ return getDataLists;
+ }
+ }
+
+ ///
+ /// 保存返修/扩透口信息
+ ///
+ /// 返修ID
+ /// 扩透口ID(多个用“,”号隔开)
+ /// 返修焊工
+ /// 返修日期
+ /// 是否切除
+ public static void GetRepairExpSaveInfo(string repairRecordId, string expandId, string repairWelder, string repairDate, bool isCut)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ Model.HJGL_RepairRecord repairRecord = BLL.RepairRecordService.GetRepairRecordById(repairRecordId);
+ // 更新返修记录
+ var repair = db.HJGL_RepairRecord.FirstOrDefault(x => x.RepairRecordId == repairRecordId);
+ if (repair != null)
+ {
+ repair.PBackingWelderId = repairWelder;
+ repair.PCoverWelderId = repairWelder;
+ repair.AuditDate = DateTime.Now;
+ repair.RepairDate = Convert.ToDateTime(repairDate);
+ if (isCut)
+ {
+ repair.IsCut = true;
+ }
+ }
+
+ // 更新返修口
+ var batchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.WeldJointId == repairRecord.WeldJointId);
+ if (batchItem != null)
+ {
+ batchItem.RepairDate = Convert.ToDateTime(repairDate);
+ if (isCut)
+ {
+ batchItem.CutDate = DateTime.Now.Date;
+ }
+ }
+ db.SubmitChanges();
+
+ var exp = BLL.RepairRecordService.GetExportItem(repairRecordId);
+ if (exp != null)
+ {
+ foreach (Model.HJGL_Batch_PointBatchItem item in exp)
+ {
+ Model.HJGL_Batch_PointBatchItem newPointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.PointBatchItemId == item.PointBatchItemId);
+ newPointBatchItem.PointState = null;
+ newPointBatchItem.PointDate = null;
+ newPointBatchItem.RepairRecordId = null;
+ db.SubmitChanges();
+ }
+ }
+ // 更新扩透口
+ string[] checkedRow = expandId.Split(',');
+ if (checkedRow.Count() > 0)
+ {
+ foreach (string item in checkedRow)
+ {
+ Model.HJGL_Batch_PointBatchItem newPointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.PointBatchItemId == item);
+ if (newPointBatchItem != null)
+ {
+ newPointBatchItem.PointState = "2";
+ newPointBatchItem.PointDate = DateTime.Now;
+ newPointBatchItem.RepairRecordId = repairRecordId;
+ db.SubmitChanges();
+ }
+ }
+ }
+ }
+ }
+ #endregion
+
+ #region 返修单审核
+ ///
+ /// 返修单审核
+ ///
+ ///
+ public static void RepairAudit(string repairRecordId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ // 更新返修记录
+ var repair = db.HJGL_RepairRecord.FirstOrDefault(x => x.RepairRecordId == repairRecordId);
+ if (!repair.AuditDate.HasValue)
+ {
+ repair.AuditDate = DateTime.Now;
+ db.SubmitChanges();
+ }
+ }
+ }
+ #endregion
+
+ #region 生成返修委托单
+ ///
+ /// 生成返修委托单
+ ///
+ ///
+ ///
+ public static string GenerateRepairTrust(string repairRecordId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ string submitStr = string.Empty;
+ Model.HJGL_RepairRecord repairRecord = BLL.RepairRecordService.GetRepairRecordById(repairRecordId);
+ var trustItem = from x in Funs.DB.HJGL_Batch_BatchTrustItem where x.RepairRecordId == repairRecordId select x;
+ if (trustItem.Count() == 0)
+ {
+ if (!string.IsNullOrEmpty(repairRecordId) && repairRecord.AuditDate.HasValue)
+ {
+ // 返修委托
+ Model.HJGL_Batch_BatchTrust newRepairTrust = new Model.HJGL_Batch_BatchTrust();
+ string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust));
+ newRepairTrust.TrustBatchId = trustBatchId;
+ newRepairTrust.TrustBatchCode = repairRecord.RepairRecordCode;
+ newRepairTrust.TrustDate = DateTime.Now;
+ newRepairTrust.ProjectId = repairRecord.ProjectId;
+ newRepairTrust.UnitId = repairRecord.UnitId;
+ newRepairTrust.UnitWorkId = repairRecord.UnitWorkId;
+ newRepairTrust.DetectionTypeId = repairRecord.DetectionTypeId;
+ var oldTrust = (from x in Funs.DB.HJGL_Batch_BatchTrust
+ join y in Funs.DB.HJGL_Batch_BatchTrustItem on x.TrustBatchId equals y.TrustBatchId
+ join z in Funs.DB.HJGL_Batch_NDEItem on y.TrustBatchItemId equals z.TrustBatchItemId
+ where z.NDEItemID == repairRecord.NDEItemID
+ select x).FirstOrDefault();
+ newRepairTrust.DetectionRateId = oldTrust.DetectionRateId;
+ newRepairTrust.TrustType = "R";
+
+ BLL.Batch_BatchTrustService.AddBatchTrust(newRepairTrust); // 新增返修委托单
+
+ Model.HJGL_Batch_BatchTrustItem newRepairTrustItem = new Model.HJGL_Batch_BatchTrustItem();
+ newRepairTrustItem.TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem));
+ newRepairTrustItem.TrustBatchId = trustBatchId;
+ newRepairTrustItem.RepairRecordId = repairRecordId;
+ newRepairTrustItem.WeldJointId = repairRecord.WeldJointId;
+ newRepairTrustItem.CreateDate = DateTime.Now;
+
+ Batch_BatchTrustItemService.AddBatchTrustItem(newRepairTrustItem);
+
+ // 扩透委托
+ var exp = BLL.RepairRecordService.GetExportItem(repairRecordId);
+ if (exp != null)
+ {
+ foreach (var q in exp)
+ {
+ Model.HJGL_Batch_BatchTrustItem newExportTrustItem = new Model.HJGL_Batch_BatchTrustItem();
+ newExportTrustItem.TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem));
+ newExportTrustItem.TrustBatchId = trustBatchId;
+ newExportTrustItem.PointBatchItemId = q.PointBatchItemId;
+ newExportTrustItem.WeldJointId = q.WeldJointId;
+ newExportTrustItem.CreateDate = DateTime.Now;
+ Batch_BatchTrustItemService.AddBatchTrustItem(newExportTrustItem);
+
+ Model.HJGL_Batch_PointBatchItem pointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.PointBatchItemId == q.PointBatchItemId);
+ pointBatchItem.IsBuildTrust = true;
+ db.SubmitChanges();
+ }
+ }
+
+ submitStr = "成功生成委托单!";
+ }
+ else
+ {
+ submitStr = "选中返修单并确认已审核!";
+ }
+ }
+ else
+ {
+ submitStr = "已生成委托单!";
+ }
+
+ return submitStr;
+ }
+ }
+ #endregion
+
+ #region 获取扩透口的随机数
+ ///
+ /// 获取扩透口的随机数
+ ///
+ ///
+ ///
+ public static string RandomExport(int num)
+ {
+ string strNum = string.Empty;
+ if (num > 0 && num <= 2)
+ {
+ if (num == 1)
+ {
+ strNum = "0";
+ }
+ else
+ {
+ strNum = "0,1";
+ }
+ }
+ else
+ {
+ int[] r = Funs.GetRandomNum(2, 0, num - 1);
+ strNum = r[0].ToString() + "," + r[1].ToString();
+ }
+
+
+ //int num = Grid1.Rows.Count;
+ //if (mark == "A")
+ //{
+ // if (pointState != "2") //非扩透口
+ // {
+ // if (num > 0 && num <= 2)
+ // {
+ // if (num == 1)
+ // {
+ // Grid1.SelectedRowIndexArray = new int[] { 0 };
+ // }
+ // else
+ // {
+ // Grid1.SelectedRowIndexArray = new int[] { 0, 1 };
+ // }
+ // }
+ // else
+ // {
+ // int[] r = Funs.GetRandomNum(2, 0, num - 1);
+ // Grid1.SelectedRowIndexArray = r;
+ // }
+ // }
+ // else //扩透口
+ // {
+ // int[] groupNum = new int[num];
+ // for (int i = 0; i < num; i++)
+ // {
+ // groupNum[i] = i;
+ // }
+
+ // Grid1.SelectedRowIndexArray = groupNum;
+ // }
+ //}
+ //else
+ //{
+ // int[] groupNum = new int[num];
+ // for (int i = 0; i < num; i++)
+ // {
+ // groupNum[i] = i;
+ // }
+
+ // Grid1.SelectedRowIndexArray = groupNum;
+ //}
+
+
+
+ return strNum;
+
+ }
+ #endregion
+
+ //////////////////////////////////////////// NDE预警//////////////////////////////////////
+
+ #region NDE预警
+ ///
+ /// 无损检测不合格焊口信息
+ ///
+ ///
+ ///
+ public static List GetNdeCheckNoPassWarn(string projectId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var onecheckNoPass = (from x in db.HJGL_Batch_NDEItem
+ join y in db.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId
+ join w in db.HJGL_WeldJoint on y.WeldJointId equals w.WeldJointId
+ join z in db.HJGL_Batch_NDE on x.NDEID equals z.NDEID
+ where y.RepairRecordId == null && x.CheckResult == "2"
+ select new Model.BaseInfoItem
+ {
+ BaseInfoId = y.WeldJointId,
+ BaseInfoCode = "检测单:" + z.NDECode,
+ BaseInfoName = "不合格焊口:" + w.WeldJointCode
+ }).ToList();
+
+ var repairPass = (from x in db.HJGL_Batch_NDEItem
+ join y in db.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId
+ join w in db.HJGL_WeldJoint on y.WeldJointId equals w.WeldJointId
+ join z in db.HJGL_Batch_NDE on x.NDEID equals z.NDEID
+ where y.RepairRecordId != null && x.CheckResult == "1"
+ select new Model.BaseInfoItem
+ {
+ BaseInfoId = y.WeldJointId,
+ BaseInfoCode = "检测单:" + z.NDECode,
+ BaseInfoName = "不合格焊口:" + w.WeldJointCode
+ }).ToList();
+
+ List getDataLists = new List();
+ foreach (var q in onecheckNoPass)
+ {
+ if (!repairPass.Contains(q))
+ {
+ getDataLists.Add(q);
+ }
+ }
+
+ return getDataLists;
+ }
+ }
+
+ ///
+ /// 未委托焊口预警
+ ///
+ ///
+ ///
+ public static List GetNoTrustJointWarn(string projectId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var point = (from x in db.HJGL_Batch_PointBatchItem
+ join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId
+ join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
+ join t in db.HJGL_Batch_BatchTrustItem on x.PointBatchItemId equals t.PointBatchItemId
+ where y.ProjectId == projectId && t.TrustBatchItemId == null
+ orderby y.PointBatchCode, z.WeldJointCode
+ select new Model.BaseInfoItem
+ {
+ BaseInfoId = x.WeldJointId,
+ BaseInfoCode = "批号:" + y.PointBatchCode,
+ BaseInfoName = "未委托焊口:" + z.WeldJointCode,
+ }).ToList();
+
+ var repair = (from x in db.HJGL_RepairRecord
+ join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
+ join t in db.HJGL_Batch_BatchTrustItem on x.RepairRecordId equals t.RepairRecordId
+ where x.ProjectId == projectId && t.TrustBatchItemId == null
+ orderby x.RepairRecordCode, z.WeldJointCode
+ select new Model.BaseInfoItem
+ {
+ BaseInfoId = x.WeldJointId,
+ BaseInfoCode = "返修单号:" + x.RepairRecordCode,
+ BaseInfoName = "未委托焊口:" + z.WeldJointCode,
+ }).ToList();
+
+ return point.Concat(repair).ToList();
+ }
+ }
+
+ ///
+ /// 未检测焊口预警
+ ///
+ ///
+ ///
+ public static List GetNoCheckJointWarn(string projectId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getDataLists = (from x in db.HJGL_Batch_BatchTrustItem
+ join y in db.HJGL_Batch_BatchTrust on x.TrustBatchId equals y.TrustBatchId
+ join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId
+ join n in db.HJGL_Batch_NDEItem on x.TrustBatchItemId equals n.TrustBatchItemId
+ where y.ProjectId == projectId && n.NDEItemID == null
+ orderby y.TrustBatchCode, z.WeldJointCode
+ select new Model.BaseInfoItem
+ {
+ BaseInfoId = x.WeldJointId,
+ BaseInfoCode = "委托单号:" + y.TrustBatchCode,
+ BaseInfoName = "焊口:" + z.WeldJointCode,
+ }).ToList();
+
+ return getDataLists;
+ }
+ }
+
+ #endregion
+
+ }
+}
diff --git a/SGGL/FineUIPro.Web/Controls/Fastreport.aspx.cs b/SGGL/FineUIPro.Web/Controls/Fastreport.aspx.cs
index 83dc2319..26e751dc 100644
--- a/SGGL/FineUIPro.Web/Controls/Fastreport.aspx.cs
+++ b/SGGL/FineUIPro.Web/Controls/Fastreport.aspx.cs
@@ -38,6 +38,10 @@ namespace FineUIPro.Web.Controls
{
ReportPath = Request.Params["ReportPath"];
WebReport1.StartReport += WebReport1_StartReport;
+ if (string.IsNullOrEmpty(ReportPath) || !System.IO.File.Exists(ReportPath))
+ {
+ throw new System.IO.FileNotFoundException("打印模板不存在!", ReportPath);
+ }
if (dataTables != null && dataTables.Count > 0)
{
for (int i = 0; i < dataTables.Count; i++)
@@ -49,8 +53,12 @@ namespace FineUIPro.Web.Controls
WebReport1.Report.Load(ReportPath);
if (WebReport1.Report.Dictionary.Connections.Count > 0)
{
- WebReport1.Report.Dictionary.Connections[0].ConnectionString = Funs.ConnString;
- WebReport1.Report.Save(ReportPath);
+ var reportConnection = WebReport1.Report.Dictionary.Connections[0];
+ if (reportConnection.ConnectionString != Funs.ConnString)
+ {
+ reportConnection.ConnectionString = Funs.ConnString;
+ WebReport1.Report.Save(ReportPath);
+ }
}
WebReport1.ReportFile = ReportPath;
WebReport1.Prepare();
@@ -69,4 +77,4 @@ namespace FineUIPro.Web.Controls
}
}
}
-}
\ No newline at end of file
+}